YAML parsing error - multidimensional arrays
I am getting this exception which points to a file with incorrect parameters:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "XXX/app/config/parameters_testing.yml" from "XXX/app/config/config_dev.yml".
(Malformed inline YAML string { id: 212, status: 3, events:[ at line 168 (near "- { id: 212, status: 3, events:["))
I am trying to nest arrays into arrays, etc., but I cannot find any useful resource and get exceptions.
cases:
- { id: 213, status: 1}
- { id: 213, status: 3, events:[
{ rec: both, event: 34}
{ rec: odd, event: 1}
{ rec: even, event: 2}
{ rec: odd, event: 29}
{ rec: odd, event: 9}
{ rec: even, event: 3}
{ rec: odd, event: 27}
{ rec: even, event: 27}
]
}
Any suggestions would be appreciated.
+3
source to share
2 answers
In addition to the accepted answer, a more readable way would be to take it out of the inline like ...
cases:
-
id: 213
status: 1
-
id: 213
status: 3
events:
- { rec: both, event: 34}
- { rec: odd, event: 1 }
- { rec: even, event: 2 }
- { rec: odd, event: 29 }
- { rec: odd, event: 9 }
- { rec: even, event: 3 }
- { rec: odd, event: 27 }
- { rec: even, event: 27 }
+4
source to share
If you declare inline you must do it on 1 line
cases:
- { id: 213, status: 1}
- { id: 213, status: 3, events:[ { rec: both, event: 34} , { rec: odd, event: 1} , { rec: even, event: 2}, { rec: odd, event: 29} , { rec: odd, event: 9}, { rec: even, event: 3}, { rec: odd, event: 27}, { rec: even, event: 27} ]}
+1
source to share