public class JSON extends Object
Constructor and Description |
---|
JSON() |
Modifier and Type | Method and Description |
---|---|
static JsonObject |
buildObject(Consumer<JsonBuilder> setup)
Build a JsonObject.
|
static JsonValue |
copy(JsonValue arg)
Create a safe copy of a
JsonValue . |
static JsonObject |
parse(InputStream input)
Parse a complete JSON object
|
static JsonObject |
parse(String string)
Parse a complete JSON object
|
static JsonValue |
parseAny(InputStream input)
Parse any JSON value, not just an object, from an input stream
|
static JsonValue |
parseAny(String string)
Parse any JSON value, not just an object, from a file
|
static JsonObject |
read(String filename)
Read a JSON object from a file
|
static JsonValue |
readAny(String filename)
Read any JSON value, not just an object, from a file
|
static String |
toString(JsonValue jValue)
JsonValue to a formatted, multiline string
|
static String |
toStringFlat(JsonValue jValue)
JsonValue to a string with no newlines
|
static void |
write(org.apache.jena.atlas.io.IndentedWriter output,
JsonValue jValue)
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON
|
static void |
write(JsonValue jValue)
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON
|
static void |
write(OutputStream output,
JsonValue jValue)
Write out a JSON value - pass a JSON Object to get legal exchangeable JSON
|
public static JsonObject parse(InputStream input)
public static JsonObject parse(String string)
public static JsonValue parseAny(InputStream input)
public static JsonValue parseAny(String string)
public static JsonObject read(String filename)
public static JsonValue readAny(String filename)
public static String toStringFlat(JsonValue jValue)
public static void write(OutputStream output, JsonValue jValue)
public static void write(org.apache.jena.atlas.io.IndentedWriter output, JsonValue jValue)
public static void write(JsonValue jValue)
public static JsonValue copy(JsonValue arg)
JsonValue
.
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.
public static JsonObject buildObject(Consumer<JsonBuilder> setup)
setup
function called to fill in the contents.
buildObject(builder->{ builder.pair("key", 1234); });
setup
- Licenced under the Apache License, Version 2.0