A simple implementation of Python processing JSON strings into dictionaries

Source: Internet
Author: User
Today a friend gives a demand:
Come on.

{' IsOK ': 1, ' isrunning ': None, ' IsError ': none}

How to convert into a dictionary

Well, one look is that JSON conversion is simple and begins:

 

Live out not to result, also reported wrong, check two hours of Baidu, did not understand.

Finally, the direct copy of the online code, OK, run successfully, but put my a variable, no, error; Start comparing two variables what is different, always thought that the double quotation marks in Python can be used casually, meaning unchanged; Finally, Baidu knows the standard format of JSON: requirements must be You can use only double quotation marks as the boundary symbol for a key or value, you cannot use single quotes, and the key must use a boundary character (double quotation marks)
Changed after the OK.

 

Perhaps other languages such as PHP,JS can recognize non-standard JSON formats, but Python does not;

Question: How does python convert to dict like a variable? The premise is that the volume of data is large .....

Above this python processing JSON string into a dictionary simple implementation is the small part to share all the content of everyone, I hope to give you a reference, but also hope that we support the script home.

  • 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.