Answer the question
In order to leave comments, you need to log in
How to correctly change json arrays so that indexing is not added?
I have a json like this:
,{
"id": 12345678,
"color": "red",
"model": {
"id": 1,
"t": "321"
}
},
,{
"id": 323,
"color": "green",
"model": {
"id": 2,
"t": "654"
}
},
"4":{
"id": 12345678,
"color": "red",
"model": {
"id": 1,
"t": "321"
}
}
Answer the question
In order to leave comments, you need to log in
array_values()
$json = json_encode(array_values($data), JSON_UNESCAPED_UNICODE);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question