I have a JSONObject store on dynamodb as following,
"info" : {
"nn": {
"nnn": [{
"nnnn": "bb"
}]
},
"ln": "zheng1",
"fn": "franky",
"sn": [{
"aa": "zheng2"
}]
}
I would like to update info.sn by UpdateItemSpec
List<JSONObject> li= new ArrayList<JSONObject>();
JSONObject j = new JSONObject();
j.append("kk","kkkk");
li.add(j);
UpdateItemSpec updateItemSpec = new UpdateItemSpec()
.withPrimaryKey("Age", age, "Name", name)
.withExpressionSpec(new ExpressionSpecBuilder()
.addUpdate(ExpressionSpecBuilder.S("phone").set("0900000222"))
.addUpdate(ExpressionSpecBuilder.S("info.ln").set("zheng32"))
.addUpdate(ExpressionSpecBuilder.list_append("info.sn", li)) // ERRO
.withCondition(ExpressionSpecBuilder.N("weight").eq(82))
.buildForUpdate())
.withReturnValues(ReturnValue.UPDATED_NEW);
error will be list_append, I cannot find out the way to update JSONArray, someone can help?