What is JSON

Source: Internet
Author: User

Official explanation

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for people to read and write. It is also easy for machine parsing and generation. It is based on the JavaScript programming Language,json in a completely language-independent text format, but also uses a language similar to the C family, which makes JSON an ideal data exchange language

What is JSON

First, JSON is a string

Strings are used to pass information, and a JSON string is actually a string that specifies the format

In this format, we can pass information to each other in different programming languages, for example, we can convert the Javascrupt object to JSON and pass it to Java, so that Java can parse the object that the Java language itself represents, so we can turn the Java object into JSON, By parsing the Json,python language, the JSON can be translated into its own dictionary or List,json to unify the communication format so that the information can be transferred smoothly between different languages.

A simple example of JSON parsing

For example, we can turn the JSON string into the Python language dict

#Coding:utf-8ImportJsonjson_str="""{"id": +, "name": "Python", "url": "Http://www.v2ex.com/go/python", "title": "Python", "Title_alt Ernative ":" Python "," topics ": 7646," stars ": 4862," header ":" Here we discuss a variety of Python language programming topics, including Django,tornado boxes The discussion of the frame. Here is a place to help you solve practical problems. "," footer ": null," created ": 1278683336," Avatar_mini ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_ mini.png?m=1504080972 "," Avatar_normal ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_normal.png?m= 1504080972 "," Avatar_large ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_large.png?m=1504080972 "}"""Res=json.loads (JSON_STR)Print(res['ID'])# -Print(res['name'])#pythonPrint(res['URL'])#Http://www.v2ex.com/go/python

What is JSON

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.