2

i have tried many ways to split the string though am not that good in this programing language my string looks like this

{"success":true," URL ":"WWW.face-book.com", "rank":9, "details":null}

how do i separate my strings in such a way that the output looks like-

URL: WWW.face-book.com
rank: 9
1
  • 10
    Start by looking at json_decode() Commented Nov 14, 2014 at 20:55

1 Answer 1

1

You use json_decode($yourJsonStringHere); and youll get an Object of the class "stdClass" with public properties for all your keys.

So you can basically do the following:

$jsonObj=json_decode($jsonString);
echo $jsonObj->URL;
echo $jsonObj->rank;
echo $jsonObj->success;
echo $jsonObj->details;

See http://php.net/manual/en/function.json-decode.php for more info on the function itself.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.