Basic conversion of json data type

1. What is JSON : It is a data format, essentially a string type

        JSON is a string representation of JS objects, which uses text to represent the information of a JS object, essentially a string.

2. The role of JSON : to solve data cross-platform compatibility

       In actual development, our front end often needs to interact with the server (back end) for data. And the front-end is different from the back-end programming language.

Front-end: js, back-end: java, c++, php, python, .net, c#, go, etc.

       Different programming language data types are inconsistent. not interoperable. In order to allow data interaction between different programming languages, people later invented a format common to all programming languages: called JSON.

3. JSON syntax :

js -> json (sent from the front end to the background):

              let jsonStr = JSON.stringify( js object )

json -> js (background to frontend):

             let jsObj = JSON.parse(json format)
 

At this time, the results that can be printed on the console are as follows:

 

 

Guess you like

Origin blog.csdn.net/weixin_66375317/article/details/124695058