Home

Awesome

usejson

A Java library that parses JSON5 or JSON format into an ordinary tree of Java objects (using types Map<> for dictionaries, and type List<> for arrays).

It is live on JitPack.

An online demonstration is here; it shows the library being used to convert JSON5 objects to plain JSON.

The parser is ported from the reference JavaScript JSON5 parser; json5.

Parser output is compatible with org.json.JSONObject.wrap, allowing output to be easily converted into org.json objects. This allows JSON5 files to be used in applications written for org.json types; allowing comments, unquoted keys, single quoted strings, line continuation in strings, hex numbers and more.

The library is written by Jim Blackler and offered under the Apache 2.0 license.

Conversion of output to org.json types

org.json objects are able to contain data parsed from JSON5 files with the following exception:

As JSON5 is a superset of JSON, classic JSON files can also be read. However, this importer differs from org.json in the following ways:

When adapted to org.json tyoes using JSONObject.wrap: