Title:Argo - A simple JSON parser and generator for Java
Description:Argo is an open source JSON parser and generator written in Java. It offers document, push, and pull APIs. It is free to download and use in your project.
Keywords:Body:?xml version="1.0" encoding="UTF-8"?
Argo - A simple JSON parser and generator for Java
Argo
Home
Downloads
Documentation
Support
Project Site
Introduction
Argo is a JSON parser and generator for Java. It offers three parse interfaces - a push parser, a pull
parser, and a DOM syle parser. It is written to be easy to use, typesafe, and fast. It is open source, and
free for you to use.
The latest version of Argo available for download is 2.1.
The javadoc is also available online.
Example
A brief example demonstrates the DOM style parser. The example is based on the following JSON, which is
assumed to be available in a String called jsonText.
{
"name": "Black Lace",
"sales": 110921,
"totalRoyalties": 10223.82,
"singles": [
"Superman", "Agadoo"
]
}
We can use Argo to get the second single like this:
String secondSingle = new JdomParser().parse(jsonText)
.getStringValue("singles", 1);
On the first line, we parse the JSON text into an object hierarchy. There are various options for navigating
this, but the simplest is just to give the path and type of node we expect.
On line two, we ask for the JSON string at index 1 of the array in the
singles field.
If we check the secondSingle variable, we will find, as expected, it contains the
String "Agadoo".