如何在PHP中使用dynamoDB查询获取Json嵌套属性值

[{
    "forms": [{
        "id": "52b55960-023e-11e7-9140-f3c1d163524b",
        "title": "Default Form",
        "update_history": [{
            "version": "1",
            "updated_at": "2016-12-10 12:12:10"
        }, {
            "version": "2",
            "updated_at": "2017-01-01 05:17:19"
        }, {
            "version": "3",
            "updated_at": "2017-02-07 03:22:39"
        }, {
            "version": "4",
            "updated_at": "2017-03-03 02:28:56"
        }, {
            "version": "5",
            "updated_at": "2017-01-11 07:01:22"
        }]
    }]
}]

I have above Json stored in Dynamo-DB table. forms object is parent object. I have stored form updated detail version and updated_at in update_history nested object. I want updated_at of version of 2. Please suggest me, what is wrong in below query. I got empty result.

`$response = $client->scan([
       'TableName' => 'TableName',
       'ProjectionExpression' => 'Json.forms.update_history.updated_at',
                    'ExpressionAttributeValues' => [
                            ':val1' => ['S' => '52b55960-023e-11e7-9140-f3c1d163524b'],
                            ':val2' => ['S' => '2']
                            ],
                    'FilterExpression' => 'id = :val1 and Json.forms.update_history.version = :val2',
        ]);` 

Please refer the DocumentPath example in the below link and try to use deference operator.

For a nested attribute, you construct the document path using dereference operators.

If you don't know the deference operator (i.e. index), you can't filter the data as you have tried.

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html#DocumentPaths

Example:-

Accessing List Elements:-

MyList[0]
AnotherList[12]
ThisList[5][11]

Accessing Map Elements:-

MyMap.nestedField
MyMap.nestedField.deeplyNestedField

You have the combination of both Map and List, you need to FilterExpression accordingly.