Jquery parsing Json format data process code_jquery
WBOY
Release: 2016-05-16 16:33:18
Original
1242 people have browsed it
Today I learned a little bit about Json. JSON (JavaScript Object Notation) is a lightweight data exchange format. Easy for humans to read and write. It is also easy for machines to parse and generate. JSON uses a completely language-independent text format, but also uses conventions similar to the C language family (including C, C, C#, Java, JavaScript, Perl, Python, etc.). These properties make JSON an ideal data exchange language.
JSON is constructed from two structures:
A collection of name/value pairs. In different languages, it is understood as an object, a record, a struct, a dictionary, a hash table, a keyed list, or an associative array. array).
An ordered list of values. In most languages, it is understood as an array.
These are common data structures. In fact most modern computer languages support them in some form. This makes it possible for a data format to be exchanged between programming languages that are also based on these structures.
JSON has the following forms:
An object is an unordered collection of name/value pairs. An object starts with "{" (left bracket) and ends with "}" (right bracket). Each "name" is followed by a ":" (colon); "name/value" pairs are separated by a "," (comma).
Okay, let’s not talk nonsense and go straight to examples! ! The design of this small demo is like this. The index.jsp page accesses the server-side servlet. The servlet transfers data to index.jsp. The transferred data is in Json format. Haha... Nonsense. If the data is not in Json format, I will write this article. A blog is equivalent to deceiving the audience!
Code on the index.jsp side (easy first, then difficult order):
Then there are two bean programs: Person and Address. These two classes are designed here mainly to better reflect the way Json transmits data and the format of the transmitted data
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn