java.lang.Object
org.apache.jena.atlas.json.JSON
A class that is the front door to the JSON subsystem
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonObjectbuildObject(Consumer<JsonBuilder> setup) Build a JsonObject.static JsonValueCreate a safe copy of aJsonValue.static JsonObjectparse(InputStream input) Parse a complete JSON objectstatic JsonObjectParse a complete JSON objectstatic JsonValueparseAny(InputStream input) Parse any JSON value, not just an object, from an input streamstatic JsonValueParse any JSON value, not just an object, from a filestatic JsonObjectRead a JSON object from a filestatic JsonValueRead any JSON value, not just an object, from a filestatic StringJsonValue to a formatted, multiline stringstatic StringtoStringFlat(JsonValue jValue) JsonValue to a string with no newlinesstatic voidwrite(OutputStream output, JsonValue jValue) Write out a JSON value - pass a JSON Object to get legal exchangeable JSONstatic voidWrite out a JSON value - pass a JSON Object to get legal exchangeable JSONstatic voidWrite out a JSON value - pass a JSON Object to get legal exchangeable JSON
-
Constructor Details
-
JSON
public JSON()
-
-
Method Details
-
parse
Parse a complete JSON object -
parse
Parse a complete JSON object -
parseAny
Parse any JSON value, not just an object, from an input stream -
parseAny
Parse any JSON value, not just an object, from a file -
read
Read a JSON object from a file -
readAny
Read any JSON value, not just an object, from a file -
toString
JsonValue to a formatted, multiline string -
toStringFlat
JsonValue to a string with no newlines -
write
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON -
write
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON -
write
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON -
copy
Create a safe copy of aJsonValue.If the JsonValue is a structure (object or array), copy the structure recursively.
If the JsonValue is a primitive (string, number, boolean or null), it is immutable so return the same object.
-
buildObject
Build a JsonObject. The outer object is created and then thesetupfunction called to fill in the contents.buildObject(builder->{ builder.pair("key", 1234); });- Parameters:
setup-- Returns:
- JsonObject
-