P
P
paulvales2016-03-03 20:45:15
PHP
paulvales, 2016-03-03 20:45:15

How to parse the received data?

Greetings. I work with one API. The data comes in a strange format:

string(758) "[{"name":"5","id":50,"title":"Econom","url":"","text":"","price":1200,"delivery_id":12,"delivery_title":"Post Express"},{"name":"PCL","title":"DPD CLASSIC PARCEL","price":1590,"time":"2 дня","id":7,"url":"http://dpd.kz/ru/tariffs/domestic/classic_parcel/","text":"","delivery_id":1,"delivery_title":"DPD Delivery"},{"name":"BZP","title":"DPD 18:00","price":3297,"time":"2 дня","id":1,"url":"http://dpd.kz/ru/tariffs/domestic/max/","text":"","delivery_id":1,"delivery_title":"DPD Delivery"},{"name":"NDY","title":"DPD EXPRESS","price":3297,"time":"1 дня","id":6,"url":"","text":"","delivery_id":1,"delivery_title":"DPD Delivery"},{"name":"6","id":51,"title":"Express","url":"","text":"","price":3500,"delivery_id":12,"delivery_title":"Post Express"}]"

after json_decode:
Array ( [0] => Array ( [name] => 5 [id] => 50 [title] => Econom [url] => [text] => [price] => 1200 [delivery_id] => 12 [delivery_title] => Post Express ) [1] => Array ( [name] => PCL [title] => DPD CLASSIC PARCEL [price] => 1590 [time] => 2 дня [id] => 7 [url] => http://dpd.kz/ru/tariffs/domestic/classic_parcel/ [text] => [delivery_id] => 1 [delivery_title] => DPD Delivery ) [2] => Array ( [name] => BZP [title] => DPD 18:00 [price] => 3297 [time] => 2 дня [id] => 1 [url] => http://dpd.kz/ru/tariffs/domestic/max/ [text] => [delivery_id] => 1 [delivery_title] => DPD Delivery ) [3] => Array ( [name] => NDY [title] => DPD EXPRESS [price] => 3297 [time] => 1 дня [id] => 6 [url] => [text] => [delivery_id] => 1 [delivery_title] => DPD Delivery ) [4] => Array ( [name] => 6 [id] => 51 [title] => Express [url] => [text] => [price] => 3500 [delivery_id] => 12 [delivery_title] => Post Express ) )

How to disassemble?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sts, 2016-03-03
@stunoff

someone useful to program without even knowing the basics of the language?
Well, here is a link for you
https://secure.php.net/manual/ru/control-structure...
https://secure.php.net/manual/ru/ref.array.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question