php - String to array or object -


actually string,

how can convert object or array ..

{"kind": "delivery_quote", "fee": 750, "created": "2016-02-28t19:13:38z", "expires": "2016-02-28t19:18:38z", "currency": "usd", "duration": 60, "dropoff_eta": "2016-02-28t20:18:38z", "id": "dqt_khc5sbjq00jn6f"} 

i tried

$array=explode(' ',$result); $json = json_encode($result); print($json); 

it giving me result this

"{\"kind\": \"delivery_quote\", \"fee\": 750, \"created\": \"2016-02-28t19:13:38z\", \"expires\": \"2016-02-28t19:18:38z\", \"currency\": \"usd\", \"duration\": 60, \"dropoff_eta\": \"2016-02-28t20:18:38z\", \"id\": \"dqt_khc5sbjq00jn6f\"}" 

but how can can take results like

echo $json->fee;  

here eval of have far.

help pls

<?php $result = '{"kind": "delivery_quote", "fee": 750, "created": "2016-02-28t19:13:38z", "expires": "2016-02-28t19:18:38z", "currency": "usd", "duration": 60, "dropoff_eta": "2016-02-28t20:18:38z", "id": "dqt_khc5sbjq00jn6f"}';  var_dump(json_decode($result)); var_dump(json_decode($result, true)); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -