I have JSON:
"{"description":"Testing","site":"http:\/\/localhost","steps":{"step":[{"command":"grabimage","parameter":"img[alt=\"Next\"]"},{"command":"click","parameter":"img[alt=\"Previous\"]"}]}}"
that is generated dynamicall by SimpleXML from an XML file:
<?xml version="1.0"?>
<pullcase>
<description>Testing</description>
<site>http://localhost:81</site>
<steps>
<step>
<command>grabimage</command>
<parameter>img[alt="Next"]</parameter>
</step>
</steps>
</pullcase>
It consists of a potentially unlimited number of "step" within "steps". When there is a single step the array is generated as:
["steps"]=>
array(1) {
["step"]=>
array(2) {
["command"]=>
string(9) "grabimage"
["parameter"]=>
string(15) "img[alt="Next"]"
}
}
While when there are multiple steps it is generated as:
["steps"]=>
array(1) {
["step"]=>
array(2) {
[0]=>
array(2) {
["command"]=>
string(9) "grabimage"
["parameter"]=>
string(15) "img[alt="Next"]"
}
[1]=>
array(2) {
["command"]=>
string(5) "click"
["parameter"]=>
string(19) "img[alt="Previous"]"
}
}
}
How do I get the array that is generated for one child element to follow the same rules as multiple?:
["steps"]=>
array(1) {
["step"]=>
array(1) {
[0]=>
array(2) {
["command"]=>
string(9) "grabimage"
["parameter"]=>
string(15) "img[alt="Next"]"
}
}