public interface WriteContext
| Modifier and Type | Method and Description |
|---|---|
DocumentContext |
add(JsonPath path,
java.lang.Object value)
Add value to array at the given path
|
DocumentContext |
add(java.lang.String path,
java.lang.Object value,
Predicate... filters)
Add value to array
|
Configuration |
configuration()
Returns the configuration used for reading
|
DocumentContext |
delete(JsonPath path)
Deletes the given path
|
DocumentContext |
delete(java.lang.String path,
Predicate... filters)
Deletes the given path
|
<T> T |
json()
Returns the JSON model that this context is operating on
|
java.lang.String |
jsonString()
Returns the JSON model that this context is operating on as a JSON string
|
DocumentContext |
put(JsonPath path,
java.lang.String key,
java.lang.Object value)
Add or update the key with a the given value at the given path
|
DocumentContext |
put(java.lang.String path,
java.lang.String key,
java.lang.Object value,
Predicate... filters)
Add or update the key with a the given value at the given path
|
DocumentContext |
set(JsonPath path,
java.lang.Object newValue)
Set the value a the given path
|
DocumentContext |
set(java.lang.String path,
java.lang.Object newValue,
Predicate... filters)
Set the value a the given path
|
Configuration configuration()
<T> T json()
java.lang.String jsonString()
DocumentContext set(java.lang.String path, java.lang.Object newValue, Predicate... filters)
path - path to setnewValue - new valuefilters - filtersDocumentContext set(JsonPath path, java.lang.Object newValue)
path - path to setnewValue - new valueDocumentContext delete(java.lang.String path, Predicate... filters)
path - path to deletefilters - filtersDocumentContext delete(JsonPath path)
path - path to deleteDocumentContext add(java.lang.String path, java.lang.Object value, Predicate... filters)
List array = new ArrayList(){{
add(0);
add(1);
}};
JsonPath.parse(array).add("$", 2);
assertThat(array).containsExactly(0,1,2);
path - path to arrayvalue - value to addfilters - filtersDocumentContext add(JsonPath path, java.lang.Object value)
path - path to arrayvalue - value to addDocumentContext put(java.lang.String path, java.lang.String key, java.lang.Object value, Predicate... filters)
path - path to objectkey - key to addvalue - value of keyfilters - filtersDocumentContext put(JsonPath path, java.lang.String key, java.lang.Object value)
path - path to arraykey - key to addvalue - value of key