public final class JsonValueUtils extends Object
Modifier and Type | Field and Description |
---|---|
static QueryFilterVisitor<Boolean,JsonValue,JsonPointer> |
JSONVALUE_FILTER_VISITOR
A generic JsonValue Query Filter Visitor.
|
Modifier and Type | Method and Description |
---|---|
static JsonValue |
expand(Map<String,Object> object)
Expands a Json Object Map, where the keys of the map are the
JsonPointer s
and the values are the value the JsonPointer resolves to. |
static String |
extractValueAsString(JsonValue json,
JsonPointer pointer)
Extracts String representation of field identified by
pointer from json object. |
static String |
extractValueAsString(JsonValue json,
String fieldName)
Extracts String representation of field identified by
fieldName from json object. |
static Map<String,Object> |
flatten(JsonValue jsonValue)
Flattens a
JsonValue to a Map, where the keys of the Map are JsonPointer s
and the values are the value the JsonPointer s resolve to. |
public static final QueryFilterVisitor<Boolean,JsonValue,JsonPointer> JSONVALUE_FILTER_VISITOR
public static JsonValue expand(Map<String,Object> object)
JsonPointer
s
and the values are the value the JsonPointer
resolves to.
For Example, the following key-value pairs
/object/array/0 , "test" /object/array/1 , "test1" /string , "stringVal" /boolean , false /number , 1 /array/0 , "value1" /array/1 , "value2"will produce the following json object
{ "object" : { "array" : ["test", "test1"] }, "string" : "stringVal", "boolean" : false, "number" : 1, "array" : ["value1", "value2"] }
object
- the Json Object Map containing the JsonPointer
s and valuesJsonValue
expanded from the object mappublic static Map<String,Object> flatten(JsonValue jsonValue)
JsonValue
to a Map, where the keys of the Map are JsonPointer
s
and the values are the value the JsonPointer
s resolve to.
For Example, the following JsonValue
{ "object" : { "array" : ["test", "test1"] }, "string" : "stringVal", "boolean" : false, "number" : 1, "array" : ["value1", "value2"] }will produce the following Map key-value pairs
/object/array/0 , "test" /object/array/1 , "test1" /string , "stringVal" /boolean , false /number , 1 /array/0 , "value1" /array/1 , "value2"
public static String extractValueAsString(JsonValue json, String fieldName)
fieldName
from json
object.
JsonValue
transformers are applied up to fieldName
but not to its components.json
- the JsonValue
object from which to extract a value.fieldName
- the field identifier in a form consumable by JsonPointer
.public static String extractValueAsString(JsonValue json, JsonPointer pointer)
pointer
from json
object.
JsonValue
transformers are applied up to fieldName
but not to its components.json
- the JsonValue
object from which to extract a value.pointer
- the field identifier as a JsonPointer
.Copyright © 2025 Open Identity Platform Community. All rights reserved.