Introduction

Argo is a JSON parser and generator for Java. It offers three parse interfaces - a push parser, a pull parser, and a DOM style 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 3.12. 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".