Package javajs.util

Class JSJSONParser

java.lang.Object
javajs.util.JSJSONParser

public class JSJSONParser extends Object
a very simple JSON parser for JSON objects that are compatible with JavaScript A gross simplification of https://github.com/douglascrockford/JSON-java A SUBSET of JSON with similarly to window.JSON.parse(): In JavaScript returns "null" for a null value, not null -- requires quoted strings for keys and values -- does not allow /xxx/ objects
Author:
Bob Hanson
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String str, boolean asHashTable)
    Could return Integer, Float, Boolean, String, Mapinvalid input: '<'String, Object>, Lst, or null
    parseMap(String str, boolean asHashTable)
    requires { "key":"value", "key":"value",....}
    Make a JSONException to signal a syntax error.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Details

      • JSJSONParser

        public JSJSONParser()
    • Method Details

      • parseMap

        public Map<String,Object> parseMap(String str, boolean asHashTable)
        requires { "key":"value", "key":"value",....}
        Parameters:
        str -
        asHashTable - TODO
        Returns:
        Map or null
      • parse

        public Object parse(String str, boolean asHashTable)
        Could return Integer, Float, Boolean, String, Mapinvalid input: '<'String, Object>, Lst, or null
        Parameters:
        str -
        asHashTable -
        Returns:
        a object equivalent to the JSON string str
      • syntaxError

        public JSONException syntaxError(String message)
        Make a JSONException to signal a syntax error.
        Parameters:
        message - The error message.
        Returns:
        A JSONException object, suitable for throwing