Package javax.json
Class Json
java.lang.Object
javax.json.Json
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonArrayBuilder
static JsonArrayBuilder
createArrayBuilder
(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
(Map<String, ?> config) static JsonPatch
createDiff
(JsonStructure source, JsonStructure target) static JsonGenerator
static JsonGenerator
createGenerator
(Writer writer) static JsonGeneratorFactory
createGeneratorFactory
(Map<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
Create an empty JsonObjectBuilderstatic JsonObjectBuilder
createObjectBuilder
(Map<String, 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
static JsonParser
createParser
(Reader reader) static JsonParserFactory
createParserFactory
(Map<String, ?> config) static JsonPatch
createPatch
(JsonArray array) static JsonPatchBuilder
Create a new JsonPatchBuilderstatic JsonPatchBuilder
createPatchBuilder
(JsonArray initialData) Create a new JsonPatchBuilderstatic JsonPointer
createPointer
(String path) Create aJsonPointer
for the given pathstatic JsonReader
static JsonReader
createReader
(Reader reader) static JsonReaderFactory
createReaderFactory
(Map<String, ?> config) static JsonNumber
createValue
(double value) static JsonNumber
createValue
(int value) static JsonNumber
createValue
(long value) static JsonString
createValue
(String value) static JsonNumber
createValue
(BigDecimal value) static JsonNumber
createValue
(BigInteger value) static JsonWriter
createWriter
(OutputStream out) static JsonWriter
createWriter
(Writer writer) static JsonWriterFactory
createWriterFactory
(Map<String, ?> config) static String
decodePointer
(String escapedPointer) static String
encodePointer
(String pointer)
-
Method Details
-
createParser
-
createParser
-
createGenerator
-
createGenerator
-
createParserFactory
-
createGeneratorFactory
-
createWriter
-
createWriter
-
createReader
-
createReader
-
createReaderFactory
-
createWriterFactory
-
createArrayBuilder
-
createObjectBuilder
Create an empty JsonObjectBuilder- Since:
- 1.0
-
createObjectBuilder
Creates a JSON object builder, initialized with the specified JsonObject.- Since:
- 1.1
-
createObjectBuilder
Creates a JSON object builder, initialized with the specified Map.- Since:
- 1.1
-
createBuilderFactory
-
createArrayBuilder
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
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
-
createValue
-
createValue
-
createValue
-
createValue
-
createValue
-
createPatch
- Parameters:
array
- with the patch operations- Returns:
- the JsonPatch based on the given operations
- Since:
- 1.1
-
createDiff
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:
-
createPatchBuilder
Create a new JsonPatchBuilder- Since:
- 1.1
-
createPatchBuilder
Create a new JsonPatchBuilder- Parameters:
initialData
- the initial patch operations- Since:
- 1.1
-
createMergePatch
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
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
Create aJsonPointer
for the given path- Since:
- 1.1
-
encodePointer
- Parameters:
pointer
- to encode- Returns:
- the properly encoded JsonPointer string
- Since:
- 1.1
-
decodePointer
- Parameters:
escapedPointer
-- Returns:
- the de-escaped JsonPointer
- Since:
- 1.1
-