Answer the question
In order to leave comments, you need to log in
Why doesn't the json_decode() function fully convert json to an array?
Hello.
The problem is that the json_decode() function does not completely convert json to an array.
I get json itself in this form from the Bison service.
{"orders":[],"report":{"_id":"5d6233029c8c427ee15ea00e","group":"28508","roomid":"28508:jzmiqr0l2p","webinarId":"28508:jzmiqr0l2p*2019-08-25T09:57:43","report":"{\"rating\":[\"rqNeNoyBH\",\"B50OXoJHr\"],\"urls\":{},\"partners\":{},\"utmStat\":{\"utm_source\":{},\"utm_medium\":{},\"utm_campaign\":{},\"utm_term\":{},\"utm_content\":{},\"utm_keyword\":{},\"utm_banner\":{},\"utm_phrase\":{},\"utm_group\":{}},\"usersMeta\":{\"B50OXoJHr\":{\"_id\":\"5d6231689c8c427ee15e9cf1\",\"playVideo\":1,\"username\":\"Натали\",\"chatUserId\":\"B50OXoJHr\",\"roomid\":\"28508:jzmiqr0l2p\",\"ip\":\"92.38.0.61\",\"mob\":false,\"np\":true,\"webinarId\":\"28508:jzmiqr0l2p*2019-08-25T09:57:43\",\"created\":\"2019-08-25T06:57:44.658Z\",\"view\":1566716264059,\"viewTill\":1566716564255,\"__v\":0,\"messages_num\":3},\"rqNeNoyBH\":{\"_id\":\"5d6231689c8c427ee15e9cf2\",\"playVideo\":1,\"username\":\"Толя\",\"chatUserId\":\"rqNeNoyBH\",\"roomid\":\"28508:jzmiqr0l2p\",\"ip\":\"92.38.0.61\",\"mob\":false,\"np\":true,\"webinarId\":\"28508:jzmiqr0l2p*2019-08-25T09:57:43\",\"created\":\"2019-08-25T06:57:44.663Z\",\"view\":1566716264065,\"viewTill\":1566716565066,\"__v\":0,\"messages_num\":4}}}","messages":"{\"B50OXoJHr\":[\"Привет\",\"Ну да\",\"Кто это?\"],\"rqNeNoyBH\":[\"Хпй\",\"Класс\",\"Я не знаю.\",\"Да и не очень...\"]}","messagesTS":"{\"B50OXoJHr\":[111,180,330],\"rqNeNoyBH\":[144,166,347,360]}","ver":2,"created":"2019-08-25T07:04:34.733Z","__v":0},"room_title":"Вечрний вебенар"}
$arr =json_decode($json, true);
Array
(
[orders] => Array
(
)
[report] => Array
(
[_id] => 5d6233029c8c427ee15ea00e
[group] => 28508
[roomid] => 28508:jzmiqr0l2p
[webinarId] => 28508:jzmiqr0l2p*2019-08-25T09:57:43
[report] => {"rating":["rqNeNoyBH","B50OXoJHr"],"urls":{},"partners":{},"utmStat":{"utm_source":{},"utm_medium":{},"utm_campaign":{},"utm_term":{},"utm_content":{},"utm_keyword":{},"utm_banner":{},"utm_phrase":{},"utm_group":{}},"usersMeta":{"B50OXoJHr":{"_id":"5d6231689c8c427ee15e9cf1","playVideo":1,"username":"Натали","chatUserId":"B50OXoJHr","roomid":"28508:jzmiqr0l2p","ip":"92.38.0.61","mob":false,"np":true,"webinarId":"28508:jzmiqr0l2p*2019-08-25T09:57:43","created":"2019-08-25T06:57:44.658Z","view":1566716264059,"viewTill":1566716564255,"__v":0,"messages_num":3},"rqNeNoyBH":{"_id":"5d6231689c8c427ee15e9cf2","playVideo":1,"username":"Толя","chatUserId":"rqNeNoyBH","roomid":"28508:jzmiqr0l2p","ip":"92.38.0.61","mob":false,"np":true,"webinarId":"28508:jzmiqr0l2p*2019-08-25T09:57:43","created":"2019-08-25T06:57:44.663Z","view":1566716264065,"viewTill":1566716565066,"__v":0,"messages_num":4}}}
[messages] => {"B50OXoJHr":["Привет","Ну да","Кто это?"],"rqNeNoyBH":["Хпй","Класс","Я не знаю.","Да и не очень..."]}
[messagesTS] => {"B50OXoJHr":[111,180,330],"rqNeNoyBH":[144,166,347,360]}
[ver] => 2
[created] => 2019-08-25T07:04:34.733Z
[__v] => 0
)
[room_title] => Вечрний вебенар
)
Answer the question
In order to leave comments, you need to log in
Remove escape characters with str_replace and then decode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question