Introduction and details of JSON

1. About JSON

JSON ( JavaScript  Object Notation, JS Object Notation) is a lightweight data interchange format. Data is stored and represented in a text format that is completely independent of the programming language. Concise and clear hierarchy makes JSON an ideal data exchange language. It is easy for humans to read and write, but also easy for machines to parse and generate, and effectively improve the efficiency of network transmission.

In the JS language, everything is an object. Therefore, any supported type can be represented by JSON, such as strings, numbers, objects, arrays, etc.

JSON is a completely language-independent text format, but uses conventions familiar to programmers of the C language family, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data exchange language.

JSON is built on two structures:

    1. A collection of name/value pairs. In various languages, this is implemented as objects , records, structures, dictionaries, hash tables, keyed lists, or associative arrays.

    2. An ordered list of values. In most languages ​​this is implemented as an array , vector, list or sequence.

These are generic data structures. Almost all modern programming languages ​​support them in some form. It makes sense that data formats interchangeable with programming languages ​​are also based on these structures.

In JSON, they are rendered like this:

     An object is an unnamed set of name/value pairs. An object begins with (left curly brace) and ends with  (right curly brace) . Each name is followed by:  (colon) and name/value pairs are separated by ,  (comma)

2. Details of JSON

Function

1 JSON format verification
After getting the JSON data, many people have no way to judge whether the JSON data format is correct or not, and whether there are fewer or more symbols and the program cannot be parsed. This function can just help everyone to complete the JSON format verification.
2 JSON view
Presumably many programmers will encounter when looking for a node, they will find that if they directly face the data line by line, they will find it impossible to start, even if they know the location, they have to search down node by node, in case they are not careful, they have to start all over again. Start looking for trouble.
With this function, all JSON data will be transformed into a view format, and it is clear at a glance, how many arrays an array. This function is very useful. Not only the view function but also the formatting, compression, escaping, and verification functions. Anyway very powerful.
3 Compression escape
When programmers write JSON statement test cases , they often directly write a JSON string for testing for convenience, but they fall into the endless trouble of escaping double quotes. This feature set compression and escaping in one, allowing you to write test cases like a duck to water.
4 JSON Online Editor
If your current computer doesn't happen to have an editor that you are familiar with, if you want to modify the data for a certain node of the JSON data obtained, this function can meet your needs.
5 Send JSON data online
We all know that JSON is mostly used in the development of web projects. If you want to test whether an interface can accurately accept JSON data, then you have to write a page to send JSON strings and do this repeatedly. With the emergence of this function, you can get rid of writing test pages, because this function can send the specified JSON data to the specified url, which is convenient.
6 JSON coloring
When many people write a document, they always hope that the document can be seen at a glance, but it doesn't matter if you are facing JSON data with black characters on a white background  .  It will be colored, and the data structure will be clear at a glance.
7 JSON-XML conversion
As the name suggests, converts JSON-formatted data into XML  [3]  Format, or data in XML format is converted into JSON format, all is not a problem.
8 JSON-VIEW
JSON viewing utility, which can format and view JSON data during the development process (in the Windows platform).
9 It is a data exchange format like xml
 

Advantage

JSON: JavaScript Object Notation ( Java Script  Object  Notation).

JSON is a syntax for storing and exchanging textual information. Similar to XML.

JSON is smaller, faster, and easier to parse than XML.

 

Differences compared to XML

  • no closing tag
  • Shorter
  • Read and write faster
  • Ability to parse using the built-in JavaScript eval() method
  • use an array
  • Do not use reserved words

Why use JSON?

JSON is faster and easier to use than XML for AJAX applications:

1. Use XML

  • Read XML documents
  • Looping through documents using the XML DOM
  • read value and store in variable

2. Use JSON

  • Read JSON string
  • Processing JSON Strings with eval()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324661374&siteId=291194637