Unable to extract JSON fields using Json Path Expression Filter

Employee

Unable to extract JSON fields using Json Path Expression Filter

Hi

 

I am trying to extract a JSON filed using the 'tExtractJSONFields' component.

 

The payload is looks like this

 

{"Records":[{"eventVersion":"2.0","eventSource":"aws:s3","awsRegion":"eu-west-2","eventTime":"2018-04-09T16:51:33.560Z","eventName":"ObjectCreated:Put","userIdentity":{"principalId":"AWS:AIDAJFTPVIK4V4O4UL3AA"},"requestParameters":{"sourceIPAddress":"81.109.43.51"},"responseElements":{"x-amz-request-id":"3F0D7CB9A0E65E00","x-amz-id-2":"bWCsY6hXSeMme6FPNmqfpNV0q7KO8byKzDFl9Yw6n2drLZcfHDNzVzMGgDrkLLL39bBhFmzu6KY="},"s3":{"s3SchemaVersion":"1.0","configurationId":"pmassieh_s3_file_creation_event","bucket":{"name":"pmassieh.talend.s3.bucket","ownerIdentity":{"principalId":"A1LVUWQKJN95HE"},"arn":"arn:aws:s3:::pmassieh.talend.s3.bucket"},"object":{"key":"walkData10.JSON","size":933,"eTag":"a9f8710f6e89c50d3f981e5421e3ef8b","sequencer":"005ACB9A1587159A23"}}}]}

I am trying to extract using this expression :

 

"$.Records[*].s3.object.key"

extract_json_field.PNG

 

When I run this the resulting output is NULL, so it appears that the Json Query fails to find the data. when I remove the expression, then the whole payload comes through intact without any issue.

 

I tried testing the filter expression against the pyalod using this (http://www.jsonquerytool.com/#/JSONPath) online tool and when I copy the JSON payload and the filter expression, then I get the desired result, however the talend component fails.

 

Any ideas ?

 

Appreciate your help

 

Thanks

 

Patrice

 

 


Accepted Solutions
Seven Stars

Re: Unable to extract JSON fields using Json Path Expression Filter

What fields are you trying to extract?  Try the following for s3.object.key

 d.pngd

 

You have "Region" duplicated, you'll need to remove that from the Loop JSONPath Query.


All Replies
Seven Stars

Re: Unable to extract JSON fields using Json Path Expression Filter

What fields are you trying to extract?  Try the following for s3.object.key

 d.pngd

 

You have "Region" duplicated, you'll need to remove that from the Loop JSONPath Query.

Employee

Re: Unable to extract JSON fields using Json Path Expression Filter

Thanks. That worked. Appreciate your help.