java.lang.Object
org.apache.jena.atlas.json.JSON
A class that is the front door to the JSON subsystem
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonObject
buildObject
(Consumer<JsonBuilder> setup) Build a JsonObject.static JsonValue
Create a safe copy of aJsonValue
.static JsonObject
parse
(InputStream input) Parse a complete JSON objectstatic JsonObject
Parse a complete JSON objectstatic JsonValue
parseAny
(InputStream input) Parse any JSON value, not just an object, from an input streamstatic JsonValue
Parse any JSON value, not just an object, from a filestatic JsonObject
Read a JSON object from a filestatic JsonValue
Read any JSON value, not just an object, from a filestatic String
JsonValue to a formatted, multiline stringstatic String
toStringFlat
(JsonValue jValue) JsonValue to a string with no newlinesstatic void
write
(OutputStream output, JsonValue jValue) Write out a JSON value - pass a JSON Object to get legal exchangeable JSONstatic void
Write out a JSON value - pass a JSON Object to get legal exchangeable JSONstatic void
Write 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 thesetup
function called to fill in the contents.buildObject(builder->{ builder.pair("key", 1234); });
- Parameters:
setup
-- Returns:
- JsonObject
-