Package javax.json
Class Json
- java.lang.Object
-
- javax.json.Json
-
public final class Json extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JsonArrayBuilder
createArrayBuilder()
static JsonArrayBuilder
createArrayBuilder(java.util.Collection<?> initialData)
Creates a JSON array builder, initialized with an initial contentstatic JsonArrayBuilder
createArrayBuilder(JsonArray initialData)
Creates a JSON array builder, initialized with an initial content taken from a JsonArraystatic JsonBuilderFactory
createBuilderFactory(java.util.Map<java.lang.String,?> config)
static JsonPatch
createDiff(JsonStructure source, JsonStructure target)
static JsonGenerator
createGenerator(java.io.OutputStream out)
static JsonGenerator
createGenerator(java.io.Writer writer)
static JsonGeneratorFactory
createGeneratorFactory(java.util.Map<java.lang.String,?> config)
static JsonMergePatch
createMergeDiff(JsonValue source, JsonValue target)
Create a JSON Merge Patch (RFC 7396) from the source and targetJsonValues
.static JsonMergePatch
createMergePatch(JsonValue patch)
static JsonObjectBuilder
createObjectBuilder()
Create an empty JsonObjectBuilderstatic JsonObjectBuilder
createObjectBuilder(java.util.Map<java.lang.String,java.lang.Object> map)
Creates a JSON object builder, initialized with the specified Map.static JsonObjectBuilder
createObjectBuilder(JsonObject object)
Creates a JSON object builder, initialized with the specified JsonObject.static JsonParser
createParser(java.io.InputStream in)
static JsonParser
createParser(java.io.Reader reader)
static JsonParserFactory
createParserFactory(java.util.Map<java.lang.String,?> config)
static JsonPatch
createPatch(JsonArray array)
static JsonPatchBuilder
createPatchBuilder()
Create a new JsonPatchBuilderstatic JsonPatchBuilder
createPatchBuilder(JsonArray initialData)
Create a new JsonPatchBuilderstatic JsonPointer
createPointer(java.lang.String path)
Create aJsonPointer
for the given pathstatic JsonReader
createReader(java.io.InputStream in)
static JsonReader
createReader(java.io.Reader reader)
static JsonReaderFactory
createReaderFactory(java.util.Map<java.lang.String,?> config)
static JsonNumber
createValue(double value)
static JsonNumber
createValue(int value)
static JsonNumber
createValue(long value)
static JsonString
createValue(java.lang.String value)
static JsonNumber
createValue(java.math.BigDecimal value)
static JsonNumber
createValue(java.math.BigInteger value)
static JsonWriter
createWriter(java.io.OutputStream out)
static JsonWriter
createWriter(java.io.Writer writer)
static JsonWriterFactory
createWriterFactory(java.util.Map<java.lang.String,?> config)
static java.lang.String
decodePointer(java.lang.String escapedPointer)
static java.lang.String
encodePointer(java.lang.String pointer)
-
-
-
Method Detail
-
createParser
public static JsonParser createParser(java.io.Reader reader)
-
createParser
public static JsonParser createParser(java.io.InputStream in)
-
createGenerator
public static JsonGenerator createGenerator(java.io.Writer writer)
-
createGenerator
public static JsonGenerator createGenerator(java.io.OutputStream out)
-
createParserFactory
public static JsonParserFactory createParserFactory(java.util.Map<java.lang.String,?> config)
-
createGeneratorFactory
public static JsonGeneratorFactory createGeneratorFactory(java.util.Map<java.lang.String,?> config)
-
createWriter
public static JsonWriter createWriter(java.io.Writer writer)
-
createWriter
public static JsonWriter createWriter(java.io.OutputStream out)
-
createReader
public static JsonReader createReader(java.io.Reader reader)
-
createReader
public static JsonReader createReader(java.io.InputStream in)
-
createReaderFactory
public static JsonReaderFactory createReaderFactory(java.util.Map<java.lang.String,?> config)
-
createWriterFactory
public static JsonWriterFactory createWriterFactory(java.util.Map<java.lang.String,?> config)
-
createArrayBuilder
public static JsonArrayBuilder createArrayBuilder()
-
createObjectBuilder
public static JsonObjectBuilder createObjectBuilder()
Create an empty JsonObjectBuilder- Since:
- 1.0
-
createObjectBuilder
public static JsonObjectBuilder createObjectBuilder(JsonObject object)
Creates a JSON object builder, initialized with the specified JsonObject.- Since:
- 1.1
-
createObjectBuilder
public static JsonObjectBuilder createObjectBuilder(java.util.Map<java.lang.String,java.lang.Object> map)
Creates a JSON object builder, initialized with the specified Map.- Since:
- 1.1
-
createBuilderFactory
public static JsonBuilderFactory createBuilderFactory(java.util.Map<java.lang.String,?> config)
-
createArrayBuilder
public static JsonArrayBuilder createArrayBuilder(JsonArray initialData)
Creates a JSON array builder, initialized with an initial content taken from a JsonArray- Parameters:
initialData
- the initial array in the builder- Returns:
- a JSON array builder
- Since:
- 1.1
-
createArrayBuilder
public static JsonArrayBuilder createArrayBuilder(java.util.Collection<?> initialData)
Creates a JSON array builder, initialized with an initial content- Parameters:
initialData
- the initial array in the builder- Returns:
- a JSON array builder
- Since:
- 1.1
-
createValue
public static JsonString createValue(java.lang.String value)
-
createValue
public static JsonNumber createValue(int value)
-
createValue
public static JsonNumber createValue(long value)
-
createValue
public static JsonNumber createValue(double value)
-
createValue
public static JsonNumber createValue(java.math.BigDecimal value)
-
createValue
public static JsonNumber createValue(java.math.BigInteger value)
-
createPatch
public static JsonPatch createPatch(JsonArray array)
- Parameters:
array
- with the patch operations- Returns:
- the JsonPatch based on the given operations
- Since:
- 1.1
-
createDiff
public static JsonPatch createDiff(JsonStructure source, JsonStructure target)
Create aJsonPatch
by comparing the source to the target as defined in RFC-6902.Applying this
JsonPatch
to the source you will give you the target.- Since:
- 1.1
- See Also:
createPatch(JsonArray)
-
createPatchBuilder
public static JsonPatchBuilder createPatchBuilder()
Create a new JsonPatchBuilder- Since:
- 1.1
-
createPatchBuilder
public static JsonPatchBuilder createPatchBuilder(JsonArray initialData)
Create a new JsonPatchBuilder- Parameters:
initialData
- the initial patch operations- Since:
- 1.1
-
createMergePatch
public static JsonMergePatch createMergePatch(JsonValue patch)
Creates JSON Merge Patch (RFC 7396) from a specifiedJsonValue
. Create a merged patch by comparing the source to the target.Applying this JsonPatch to the source will give you the target.
If you have a JSON like
{ "a": "b", "c": { "d": "e", "f": "g" } }
Then you can change the value of "a" and removing "f" by sending:
{ "a":"z", "c": { "f": null } }
- Parameters:
patch
- the patch- Returns:
- a JSON Merge Patch
- Since:
- 1.1
-
createMergeDiff
public static JsonMergePatch createMergeDiff(JsonValue source, JsonValue target)
Create a JSON Merge Patch (RFC 7396) from the source and targetJsonValues
. Create a merged patch by comparing the source to the target.Applying this JsonPatch to the source will give you the target.
If you have a JSON like
{ "a": "b", "c": { "d": "e", "f": "g" } }
Then you can change the value of "a" and removing "f" by sending:
{ "a":"z", "c": { "f": null } }
- Parameters:
source
- the sourcetarget
- the target- Returns:
- a JSON Merge Patch
- Since:
- 1.1
-
createPointer
public static JsonPointer createPointer(java.lang.String path)
Create aJsonPointer
for the given path- Since:
- 1.1
-
encodePointer
public static java.lang.String encodePointer(java.lang.String pointer)
- Parameters:
pointer
- to encode- Returns:
- the properly encoded JsonPointer string
- Since:
- 1.1
-
decodePointer
public static java.lang.String decodePointer(java.lang.String escapedPointer)
- Parameters:
escapedPointer
-- Returns:
- the de-escaped JsonPointer
- Since:
- 1.1
-
-