Support Questions
Find answers, ask questions, and share your expertise

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
4 REPLIES 4

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

Explorer

Hi @anusha_vemuri I have the same problem, did you resolved this? If yes how did you make this?

Community Manager

@GuiCaixeta, as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

Explorer

 @VidyaSargur thank you, I'll do this.