I have an array that looks like this
Array
(
[0] => Array
(
[string] => something
[name] => test
[int] => 1
)
[1] => Array
(
[string] => another
[name] => test2
[int] => 43
)
)
Which i want to convert to a specific JSON layout looking like this
[
{
"string": "something",
"name": "test",
"int": "1"
},
{
"string": "another",
"name": "test2",
"int": "43"
}
]
The problem is that, when i use the built in PHP function json_encode my output does not look the way i want but instead look like this
{"0":{"string":"something","name":"test","int":1},"1":{"string":"another","name":"test2","int":43}}
Basicly is there a way to remove the indexes from the conversion ?
json_encode( array_values( $yourArray ) ). Better solution: show the code in which you create the array.