Class JsonParser

java.lang.Object
com.oorian.json.JsonParser

public class JsonParser extends Object
A lightweight JSON parser that converts JSON text into JsonValue objects.

JsonParser is a simple recursive descent parser that handles all standard JSON data types: objects, arrays, strings, numbers, booleans, and null.

Each call to parse(String) creates a new parser instance, making it safe for concurrent use from multiple threads.

For convenience, use JsonValue.parse(String), JsonObject.parse(String), or JsonArray.parse(String) instead of calling this class directly.

  • Method Details

    • parse

      public static JsonValue parse(String text)
      Parses a JSON string into the appropriate JsonValue subtype.
      Parameters:
      text - the JSON string to parse.
      Returns:
      the parsed JsonValue.
      Throws:
      RuntimeException - if the JSON is malformed.