Answer the question
In order to leave comments, you need to log in
How to concatenate two json strings?
There are two lines like this
[
{"MIGX_id":"1","image":"1.gif","title":"бе"},
{"MIGX_id":"2","image":"dom_17.gif","title":"ме"}
]
[
{"MIGX_id":"1","image":"tes.gif","title":"yes"},
{"MIGX_id":"2","image":"ex.gif","title":"no"}
]
[
{"MIGX_id":"1","image":"1.gif","title":"бе"},
{"MIGX_id":"2","image":"dom_17.gif","title":"ме"},
{"MIGX_id":"3","image":"tes.gif","title":"yes"},
{"MIGX_id":"4","image":"ex.gif","title":"no"}
]
Answer the question
In order to leave comments, you need to log in
json_encode(array_merge(json_decode($a, true),json_decode($b, true)))
1) Remove the characters [ ] from each line. The symbols will be at the edges, so you don't need to search. As a last resort, there are the strpos and substr functions.
2) Glue the lines using a comma as a separator
3) Glue the characters [ ] along the edges of the resulting line
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question