Reputation: 373
i want to get the values of different fields in Json by using php
Upvotes: 0
Views: 1024
Reputation: 586
json_decode($string) will return an object from which you can get the values you assigned.
For example:
$myObject = new MyObject();
$myObject -> att1 = 5;
$string = json_encode($myObject);
//here's how you get the value:
$myJsonDecodedObject = json_decode($string);
$value = $myJsonDecodedObject -> att1;
Upvotes: 2