Class JSONElement

  • Direct Known Subclasses:
    JSONArray, JSONObject

    public abstract class JSONElement
    extends java.lang.Object
    • Method Detail

      • write

        public java.io.Writer write​(java.io.Writer sw)
                             throws JSONException
        Write the JSON to a Writer
        Parameters:
        sw - the writer
        Returns:
        the same Writer
        Throws:
        JSONException - for IO problems
      • write

        public java.io.Writer write​(java.io.Writer sw,
                                    int indentFactor,
                                    int indent)
                             throws JSONException
        Write the JSON to a Writer with a pretty format due to limitations in GSON the index and indent are currently ignored
        Parameters:
        sw - the writer
        indentFactor - currently ignored
        indent - currently ignored
        Returns:
        the same Writer
        Throws:
        JSONException - for IO problems
      • query

        public java.lang.Object query​(java.lang.String query)
        query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901
        Parameters:
        query - the pointer to get
        Returns:
        the thing you asked for
      • query

        public java.lang.Object query​(JSONPointer query)
        query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901
        Parameters:
        query - the pointer to get
        Returns:
        the thing you asked for
      • optQuery

        public java.lang.Object optQuery​(java.lang.String query)
      • optQuery

        public java.lang.Object optQuery​(JSONPointer query)
      • toPrettyJson

        protected static java.lang.String toPrettyJson​(JsonEngine.Element obj)
      • toMap

        protected static java.util.Map<java.lang.String,​java.lang.Object> toMap​(JsonEngine.Element obj)