1. json is a simple data description format. The symbols used contain a set of unordered key-value pairs of different types. braces {} & amp; nbsp; brackets [] & amp; nbsp; ing character Colon: & amp; nbsp; double quotation marks & quot; & amp; nb
1. json is just a simple data description format. The symbols used contain a set of unordered key-value pairs of different types. The set braces {} are a set of identical sorted set square brackets [] ing characters Colon: the double quotation mark "" delimiter comma, as shown in the following example:
/* From Network * // describe a person var person = {"Name": "Bob", "Age": 32, "Company": "IBM", "Engineer ": true} // obtain the information of this person var personAge = person. age; // describe several people var members = [{"Name": "Bob", "Age": 32, "Company": "IBM", "Engineer ": true },{ "Name": "John", "Age": 20, "Company": "Oracle", "Engineer": false },{ "Name ": "Henry", "Age": 45, "Company": "Microsoft", "Engineer ": false}] // read the company name var johnsCompany = members [1]. company; // describe a meeting var conference = {"Conference": "Future Marketing", "Date": "2012-6-1", "Address": "Beijing", "Members ": [{"Name": "Bob", "Age": 32, "Company": "IBM", "Engineer": true}, {"Name": "John ", "Age": 20, "Company": "Oracle", "Engineer": false },{ "Name": "Henry", "Age": 45, "Company ": "Microsoft", "Engineer": false}]} // reads whether the participant Henry is an Engineer var henryIsAnEngineer = conference. members [2]. engineer;
2. jsonp is totally different from this. As we all know, Ajax cannot carry out cross-request, but remote cross-origin request files are acceptable, such as scripts to request remote files, in this way, the remote server can load the data into the js format file for the client to call. Because the json format is simple and clear, and the client can process the data conveniently, JSONP is an unofficial protocol that allows the server to integrate Script tags to return to the client, cross-origin access is implemented through javascript callback (this is only a simple implementation form of JSONP ). This Protocol is characterized by the client passing a callback function to the server to process json data. As follows: