我正在從AWS DynamoDB接收JSON。 我無法訪問嵌套的項目。從aws dynamodb解析json
我試着檢索兩個領域, 'session_nr' 和 'session_type_name',從這個JSON:
{content={S: {"session_nr":"PG8","session_name":"Title of this session","session_type_name":"blah blah name type"},}}
這是怎麼每個記錄出現。 到目前爲止,這是我的代碼有,使用AWS ScanResult:
ScanRequest scanRequest = new ScanRequest()
.withTableName("table_name")
.withFilterExpression("field = :val")
.withProjectionExpression("content")
.withExpressionAttributeValues(expressionAttributeValues);
ScanResult scanResult = client.scan(scanRequest);
for (Map<String, AttributeValue> item : scanResult.getItems()) {
System.out.println(item);
}
我已經收到了回報地圖。在任何情況下,嘗試你的建議,用這一行得到一個錯誤:Map map = ObjectMapper.class.readValue(item.get(「content」)。getS(),new TypeReference
你收到了什麼錯誤? – notionquest