JSON (JavaScript Object Notation) is a lightweight data exchange format. Easy to read and write. It is also easy to parse and generate machines. It is based on a subset of JavaScript Programming Language, Standard ECMA-262 3rd Edition-December 1999. JSON uses a completely language-independent text format, but it also uses a habit similar to the C language family,
This article mainly introduces the conversion between JSON strings and objects. For more information, see JSON (JavaScript Object Notation), which is a subset of JavaScript programming language. JSON is a subset of JavaScript, so it can be clearly used in this language.
Eval function JSON text conversion to object
To
like the serialized string in PHP. It is a data description. For example, if we store an array after serialization, we can easily apply it after deserialization. JSON is the same, but it builds a bridge between client Javascript and server PHP. We use PHP to generate the JSON string, and then pass the string to the front-end Javascript. Then we can easily apply
(e.g.: firstName = Brett lastName = McLaughlin email = brett@newInstance.com) and xml (Json is short for JavaScript Object Notation, which means it comes from javascript. Due to the popularity of ajax, most websites adopt the ajax mode and architecture, json will be the first choice for data transmission (the text method is too simple to understand when there is a large amount of data, the xml method has
(e.g.: firstName = Brett lastName = McLaughlin email = brett@newInstance.com) and xml (Json is short for JavaScript Object Notation, which means it comes from javascript. Due to the popularity of ajax, most websites adopt the ajax mode and architecture, json will be the first choice for data transmission (the text method is too simple to understand when there is a large amount of data, the xml method has
What is JSON?
JSON refers to JavaScript Object notation (JavaScript Notation)
JSON is a lightweight text data interchange Format
JSON Independent of Language *
JSON is self-descriptive and easier to understand
*
framework.Identifies the target platform of an independent application. It contains all its dependencies, including the platform-specific. NET Core runtime required by the corresponding platform. Alternatively, if the project is portable, project. json identifies the framework on which the project will be installed on the target computer (on which the Assembly will be run.These three tasks are distributed in four main parts of project.
This article introduces the basic knowledge of JSON. I still don't know what JSON is before getting started with Ajax. I only saw this word when I was reading Jeffrey Zhao's deep Atlas series, so it is necessary to know about JSON. Here I will record my learning with my first understanding and a small exercise.
What is JSON
formAn array is an ordered collection of values (value). An array begins with "[" (the left square bracket), and "]" (the right square bracket) ends. Use "," (comma) to separate values.For classes in Java, we can think of this as an array of objects that can be placed in double quotation marks (string), value (number), True, false, NULL, object, or array. These structures can be nested.The following is an example of using an array form:["Zhaokaiqiang",22,"Qingdao",{"Year": 1992,"Month": 1,"Day"
subset of JavaScript, so it can be clearly used in this language.
The Code is as follows:
Var myJSONObject = {"bindings ":[{"IrcEvent": "PRIVMSG", "method": "newURI", "regex": "^ http ://.*"},{"IrcEvent": "PRIVMSG", "method": "deleteURI", "regex": "^ delete .*"},{"IrcEvent": "PRIVMSG", "method": "randomURI", "regex": "^ random .*"}]};
In the preceding example, an object with a separate member "bindings" is created. This member includes an array containing three objects ("ircEvent", "method"
The processing of JSON by JSJson2.js's Source Address:Https://github.com/douglascrockford/JSON-jsJson2.js provides a way to serialize and deserialize JSON, convert a JSON object to a JSON string, or convert a JSON string to a
Android Network requests json data, parses json data, and generates corresponding java bean classes in one step for quick development
Android Network requests generally involve image and JSON data. How can I quickly request network JSON data, parse JSON data, and
first layer encapsulates filmInfo. setCode (code); List // Second layer resolution for (int I = 0; I
3. GsonFramework Technology
(1) convert the string {} In json format to a Java objectAPI:FromJson (String json, Class
Step 1) import the jar package of Gson to the project. 2) create a Gson object: Gson gson = new Gson (). 3) Call the fromJson () method through the created Gson object, returns the Java
json?
Versions starting from php5.2 and later have built-in json support, mainly including two functions:
Json_encode (): encoded to generate a json stringJson_decode (): a decoder
Note:After json_encode () function encoding, a json string is returned, for example, $
), an object (in curly brackets), true/false/null.
Data are separated by commas:
Brackets save objects: objects can contain various types of data, including arrays.
Square brackets save an array: numbers can contain objects.
For example:
{ "employees": [ { "firstName": "Bill", "lastName": "Gates" }, { "firstName": "George", "lastName": "Bush" } ]}
2. If JSON contains esc
(constants, private variables, methods, and so on) are lost.
IV. json_decode ()
This function is used to convert json text to the corresponding PHP Data structure. The following is an example:
The code is as follows:
$ Json = '{"foo": 12345 }';$ Obj = json_decode ($ json );Print $ obj-> {'foo'}; // 12345
In general, json_decode () always returns a PHP object
More and more projects and development plug-ins now support and use json data formats by default, as a way of data persistence and transmission.There are many other formats. For example, a maximum of xml is used. The standard data format of webservice.However, because json is a JavaScript Object Notation (JavaScript Object Notation), it naturally supports js well,So now many ajax and so on use
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 ea
Project (Https://github.com/FasterXML/jackson). Jackson is a tool suite for data processing, and its highlights are streaming JSON parsers and generators. It is designed for Java and can handle other non-JSON encodings as well. Judging from our statistics on GitHub, it should be the most popular JSON parser.
Oracle's JSONP (https://jsonp.java.net/). JSONP (
What is JSON:
JSON (JavaScript Object notation) is a lightweight data interchange format. Easy for people to read and write. It is also easy to machine parse and generate. It is based on JavaScript programming Language, Standard ECMA-262 a subset of 3rd Edition-december 1999. JSON uses a completely language-independent
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.