Answer the question
In order to leave comments, you need to log in
How to save data in php to json file, as an array of objects, without keys?
For example, there is a regular array like this:
$arr = [
[
'name' => 'test',
'type' => 'test'
],
[
'name' => 'test',
'type' => 'test'
],
[
'name' => 'test',
'type' => 'test'
],
];
[
{
'name':'test',
'type':'test'
},
{
'name':'test',
'type':'test'
}
]
{
'0':{
'name':'test',
'type':'test'
},
'1': {
'name':'test',
'type':'test'
}
}
Answer the question
In order to leave comments, you need to log in
json_encode converts the object "as is".
Most likely the array has keys.
Try to create a new array in a loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question