S
S
Senbonzakuraa2018-06-17 17:36:25
PHP
Senbonzakuraa, 2018-06-17 17:36:25

How to output or concatenate 2 json in php?

There are 2 json by type:

"item":
[{      "id": "550",
      "name": "Серега"
}]

And second json :
"item":
[{      "id": "550",
       "city": "LA"
}].

Actually, how to display them in one cycle? So that the missing keys and values ​​\u200b\u200bare substituted by id, or bring them to the form:
"item":
        [{      "id": "550",
                "name": "Серега",
                "city": "LA"
        }].

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2018-06-17
@gangstarcj

First, convert both to arrays.
Then in one you need to replace the keys with the key from the id field
Then run the second one through the forych and add the fields from the first one by the key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question