Java Reference
In-Depth Information
Chapter 19. Processing JSON Data
Introduction
JSON, or JavaScript Object Notation, is:
▪ A simple, lightweight data interchange format.
▪ A simpler, lighter alternative to XML (see Chapter 20 ) .
▪ Easy to generate with printlns or with one of several APIs.
▪ Recognized directly by the JavaScript parser in all web browsers.
▪ Supported with add-on frameworks for all common languages (Java, C/C++, Perl, Ruby,
Python, Lua, Erlang, Haskell, to name a few); a ridiculously long list of supported lan-
guages (including two dozen parsers for Java alone) is right on the homepage .
A simple JSON message might look like this:
softwareinfo.json
{
"name"
"name" : "robinparse" ,
"version"
"version" : "1.2.3" ,
"description"
"description" : "Another Parser for JSON" ,
"className"
"className" : "RobinParse" ,
"contributors"
"contributors" : [
"Robin Smythe" ,
"Jon Jenz" ,
"Jan Ardann"
]
}
As you can see, the syntax is simple, nestable, and amenable to human inspection.
The JSON home page provides a concise summary of JSON syntax. There are two kinds of
structure: JSON Objects (maps) and JSON Arrays (lists). JSON Objects are sets of name and
Search WWH ::




Custom Search