JSON overview and Python processing data types such as JSON

Source: Internet
Author: User

< A, concept >

serialization (serialization): Converts the state information of an object into a process that can be stored or transmitted over a network , in the form of JSON, XML, and so on. deserialization (deserialization): is to read the state of the deserialized object from the storage area (json,xml) and recreate the object.

JSON (JavaScript Object Notation): A lightweight data interchange format that is easier to read and write than XML, is easy to parse and generate, and JSON is a subset of JavaScript.

Python2.6 begins to add JSON modules without additional download, and thePython JSON module serialization and deserialization process is encoding and Decoding

encoding: Converts a Python object encoding into a JSON string
decoding: Converting JSON format string decoding to Python object
For simple data types (string, Unicode, int, float, list, tuple, dict), you can directly handle ...

< two, Examples app>

1,the Json.dumps method is encoding for simple data types:

Python repr ();

Python json.dumps ();

Convert list to str

2,Json.loads method handles decoding (decoding) conversions of simple data types

JSON overview and Python processing data types such as JSON

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.