Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Apache Nifi - Writing a JSON file to PutDynamoDB

Apache Nifi - Writing a JSON file to PutDynamoDB

New Contributor

Hi,

I am trying to use the PutDynamoDB processor to write the following JSON object into a table in DynamoDB. However, when I go to the dynamodb table, the entire JSON object from the FlowFile lands under the property set in JSON Document Attribute (in this case, activity).

JSON Input:

{

"messageid": "1",

"application": "value 1",

"datetime": "value 2",

"dev": "value 3",

"activity": "value 4"

}

For example, I have the below in a field called activity in dynamodb table. Attached is a screenshot of the table in dynamodb capture.jpg

Output in DynamoDB table under a field called 'activity':

{

"application" : {

"S" : "value 1"

},

"datetime" : {

"S" : "value 2"

},

"dev" : {

"S" : "value 3"

},

"activity" : {

"S" : "value 4"

},

"messageid" : {

"S" : "1"

}

}

I want the JSON contents of the FlowFile to land in DynamoDB as a record with a messageid and 4 fields with their respective values. I don't know if this is a bug or if I am using it incorrectly. Is there any workaround?

Any help will be appreciated

Thanks!


capture.jpg
1 REPLY 1
Highlighted

Re: Apache Nifi - Writing a JSON file to PutDynamoDB

New Contributor

This is how AWS marshalls their data in DynamoDB. You can use the converter in the AWSJavaScriptSDK to unmarshall it for use in your application. https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/Converter.html

Don't have an account?
Coming from Hortonworks? Activate your account here