Class JsonParser


public class JsonParser extends Object

An extremely simple JSON parser that interprets JSON objects as Java primitives. JSON types are mapped to Java types as follows:

Mapping of JSON types to Java types
JSON type Java type
string String
number Number (Long or Double)
object Map<String, Object>
array List<Object>
boolean boolean
null null

JsonParser instances are not thread-safe; only one thread may safely use a single parser at a time, but parsers can be reused (i.e. callers do not need to construct a new parser for each parsing operation).

Jon Chambers
  • Constructor Details

    • JsonParser

      public JsonParser()
      Constructs a new JSON parser. Parsers are not thread-safe, but may be reused.
  • Method Details

    • parseJsonObject

      public Map<String,Object> parseJsonObject(String jsonString) throws ParseException
      Parses the given JSON string as a JSON object.
      jsonString - the JSON string to parse
      a Map representing the JSON object
      ParseException - if the given JSON string could not be parsed as a JSON object for any reason