public class SimpleJsonParser
extends java.lang.Object
Simple JSON parser. This parser is optimized for simplicity, not performance, so code that wants to parse large or complex JSON documents should use a different JSON parser.
This parser has specifically been written in order to minimize the dependencies needed for parsing JSON document. It only uses the Java 8 SE API and the Apache Commons Lang 3 library.
This parser is able to parse any document that complies with the JSON (ECMA-404) standard. Compared to many other parsers, this parser is very strict about compliance and will typically refuse any input that is not strictly compliant.
This parser converts JSON objects to Java objects using the following rules:
Map<String, Object>
.
The order of the members is preserved in the map. The parser does not allow
duplicate member keys in objects. If a member using the same key as an
earlier member is found, the parser throws an exception.List<Object>
.String
.Number
. The actual type of the
Number
depends on the number's value and should be regarded as an
implementation detail that might change in the future.Boolean
.null
is converted to null
.SimpleJsonGenerator
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
parse(java.lang.String jsonString)
Parses the specified string into a Java object.
|
public static java.lang.Object parse(java.lang.String jsonString)
jsonString
- string that represents a valid JSON document.null
if and only if the
jsonString
is the literal string "null".java.lang.IllegalArgumentException
- if the jsonString
cannot be parsed because it is
either invalid, or there is an object with duplicate member
keys.Copyright © 2017–2017 aquenos GmbH. All rights reserved.