How does PHP convert a JSON string to an object

Source: Internet
Author: User
I want to convert JSON to an object,,,,,,,,,,,,,, help----How to convert a JSON string to an object by the PHP language


Reply to discussion (solution)

First the JSON to the array, then the array to the object

Json_decode ($json), Object
Json_decode ($json, true), array

Is that so?

$array 1=array ();
$array 1=json_decode ($json, true);
Dump ($array 1);
Exit

Is there a concrete example?

I now have specific JSON data that has been

Want to turn it into an object to the client convenient JS parsing and viewing

Then you have to decode it on the client.

If you want to be on the client side, you can use the JS Json.parse () method to convert the JSON string to an object.

  
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.