public interface JSONElement
extends java.lang.Cloneable
| Modifier and Type | Method and Description |
|---|---|
JSONElement |
clone()
Clone the element.
|
static JSONElement |
fromString(java.lang.String value)
Creates a JSONElement from a String.
|
boolean |
isEmpty()
Check if JSONObject is empty.
|
int |
length()
Get the length of the the JSONElement.
|
java.lang.Object |
query(JSONPointer jsonPointer)
Uses a user initialized JSONPointer and tries to match it to an item within this JSONElement.
|
java.lang.Object |
query(java.lang.String jsonPointer)
Creates a JSONPointer using an initialization string and tries to match it to an item within this JSONElement.
|
java.lang.String |
toString(int indentFactor)
Make a pretty-printed JSON text of this JSONElement.
|
java.io.Writer |
write(java.io.Writer writer)
Write the contents of the JSONObject as JSON text to a writer.
|
java.io.Writer |
write(java.io.Writer writer,
int indent)
Write the contents of the JSONElement as JSON text to a writer, without keeping the keys natural order.
|
java.io.Writer |
write(java.io.Writer writer,
int indent,
boolean isValue,
JSONOptions options)
Write the contents of the JSONElement as JSON text to a writer.
|
default java.io.Writer |
write(java.io.Writer writer,
int indent,
JSONOptions options)
Write the contents of the JSONElement as JSON text to a writer.
|
int length()
boolean isEmpty()
static JSONElement fromString(java.lang.String value) throws JSONException
value - the String valueJSONException - if the element if not a JSONArray nor a JSONObjectJSONElement clone()
java.lang.Object query(java.lang.String jsonPointer)
jsonPointer - string that can be used to create a JSONPointerjava.lang.Object query(JSONPointer jsonPointer)
jsonPointer - string that can be used to create a JSONPointerjava.lang.String toString(int indentFactor)
throws JSONException
indentFactor - the indentation FactorJSONExceptionjava.io.Writer write(java.io.Writer writer)
throws JSONException
Warning: This method assumes that the data structure is acyclical.
writer - the writerJSONException - if the JSONElement was unable to be serializedjava.io.Writer write(java.io.Writer writer,
int indent)
throws JSONException
writer - Writes the serialized JSONindent - The indentation of the top levelJSONException - if the JSONElement was unable to be serializeddefault java.io.Writer write(java.io.Writer writer,
int indent,
JSONOptions options)
throws JSONException
writer - Writes the serialized JSONindent - The indentation of the top leveloptions - the JSON configuration optionsJSONException - if the JSONElement was unable to be serializedjava.io.Writer write(java.io.Writer writer,
int indent,
boolean isValue,
JSONOptions options)
throws JSONException
writer - Writes the serialized JSONindent - The indentation of the top levelisValue - true to write a valueoptions - the JSON configuration optionsJSONException - if the JSONElement was unable to writeCopyright (C) 2017 Wei Song. Copyright (c) 2002 JSON.org. Copyright © 2018, 2019, 2026 Herve Girod. All Rights Reserved. elasticlunr Documentation and source under the MIT licence. JSON Documentation and source under the JSON licence