public class JsonUtils
extends java.lang.Object
| Constructor and Description |
|---|
JsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static io.vertx.core.json.JsonObject |
flatten(io.vertx.core.json.JsonObject obj)
Recursively flattens a hierarchy of JSON objects.
|
public static io.vertx.core.json.JsonObject flatten(io.vertx.core.json.JsonObject obj)
Recursively flattens a hierarchy of JSON objects. Combines keys of parents and their children by concatening them with a dot. For example, consider the following object:
{
"type": "Person",
"person": {
"firstName": "Clifford",
"lastName": "Thompson",
"age": 40,
"address": {
"street": "First Street",
"number": 6550
}
}
}
This object will be flattened to the following one:
{
"type": "Person",
"person.firstName": "Clifford",
"person.lastName": "Thompson",
"person.age": 40,
"person.address.street": "First Street",
"person.address.number": 6550
}
obj - the object to flatten