I am new to PHP and I am trying to convert an array to json, without the indices.
For an example, I have:
[{"name":"Dean"},{"last_name":"Don"},{"age":31},{"height":181}]
I need it to be a single json object:
{
"name":"Dean,
"last_name":"Don",
"age":31,
"height":181
}
I tried using json_encode()
but all I get is not correct, I event tried specifying
JSON_FORCE_OBJECT
, which put the indices, which I don't want.
Anyone has an idea how to solve it? Thank you