Java Reference
In-Depth Information
value pairs, which can be represented either as a java.util.Map or as the properties of a
Java object. For example, the fields of a LocalDate (see Finding Today's Date ) object for
April 1, 2014, might be represented as:
{
"year"
"year" : 2014 ,
"month"
"month" : 4 ,
"day"
"day" : 1
}
JSON Arrays are ordered lists, represented in Java either as arrays or as java.util.List s.
A list of two dates might look like this:
{
[{
"year"
"year" : 2014 ,
"month"
"month" : 4 ,
"day"
"day" : 1
} , {
"year"
"year" : 2014 ,
"month"
"month" : 5 ,
"day"
"day" : 15
} ]
}
JSON is free-format, so the preceding could also be written, with some loss of human-read-
ability but no loss of information or functionality, as:
{ [{ "year"
"year" : 2014 , "month"
"month" : 4 , "day"
"day" : 1 } , { "year"
"year" : 2014 , "month"
"month" : 5 , "day"
"day" : 15 } ]}
Hundreds of parsers have, I'm sure, been written for JSON. A few that come to mind in the
Java world include the following:
stringtree.org
Very small and light weight
json.org parser
Widely used because it's free and has a good domain name
Search WWH ::




Custom Search