A query result come in the form of list of
Map<String, AttributeValue>
,
To convert a single Map<String, AttributeValue>
to a JSON
the only way I have found is to iterate over each key in the map,
and build the JSON string.
final ObjectNode node = JsonNodeFactory.instance.objectNode();
for (final Entry<String, AttributeValue> entry : item.entrySet()) {
node.put(entry.getKey(), getJsonNode(entry.getValue(), depth + 1));
}
Is there a more efficient way to achieve this? Is there a way to get a result from dynamoDB as JSON.