jsonWriter.key(tableKey).array();
for (WriteRequest request : unprocessedItems.get(tableKey)) {
//begin each object of array
jsonWriter.object();
PutRequest putRequest = request.getPutRequest();
DeleteRequest deleteRequest = request.getDeleteRequest();
if (putRequest != null) {
//Begin put request
jsonWriter.key("PutRequest").object();
Map<String, AttributeValue> item = putRequest.getItem();
if (item != null) {
for (String itemKey : item.keySet()) {
//begin attribute value
jsonWriter.key(itemKey).object();
AttributeValue value = item.get(itemKey);
if (value.getN() != null) {
jsonWriter.key("N").value(value.getN());
} else if (value.getS() != null) {
jsonWriter.key("S").value(value.getS());
} else if (value.getB() != null) {
jsonWriter.key("B").value(value.getS());
} else if (value.getSS() != null) {
jsonWriter.key("SS").value(value.getS());
} else if (value.getNS() != null) {
jsonWriter.key("NS").value(value.getNS());
} else if (value.getBS() != null) {
jsonWriter.key("BS").value(value.getSS());
}
//end attribute value
jsonWriter.endObject();
}
}
//end put request
jsonWriter.endObject();
} else if (deleteRequest != null) {
//Begin delete request
jsonWriter.key("DeleteRequest").object();
Key key = deleteRequest.getKey();
if (key != null) {
//begin key
jsonWriter.key("Key").object();
AttributeValue hashKeyElemenet = key.getHashKeyElement();
AttributeValue rangeKeyElement = key.getRangeKeyElement();