Good evening. There was a difficulty: how to take data from a file, if it has data content

24 Х{"clientVersion": "World of Warplanes 1.3.1 ", "playerName": "InnoT20", "mapDisplayName": "02_el_hallouf", "dateTime": "07.05.2014 22:25:48", "mapName": "02_el_hallouf", "gameplayID": 6, "playerVehicle": "ki-33"}Tњ xШ е¶ 

etc. wondering how to get json information
tried to do var_dump
writes null
I'm at a dead end, how to be?

  • one
    if an object is guaranteed to be there, then trim to the left of the first bracket and to the right of the last. - etki
  • airplane, map, etc. may be different and have different number of symbols - InnoT20
  • one
    @innot now our dialogue looks like this: - A bag of sugar is to the left of the jam and to the right of the method - But it can be of different width! - etki

1 answer 1

To parse a json string in PHP there is a json_decode function ($ vasha_json_stroka);

 $json = '{var : 1, var2 : "asd"}' ; $arr = json_decode($json) ; var_dump($arr) ; 

Displays the following

 array( var => 1, var2 => asd ) ;