- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Specifying Datatype to JSON Key-Values while doing an Attribute To JSON conversion with NiFi
- Labels:
-
Apache NiFi
Created 01-30-2017 05:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I am doing an attribute to json conversion using NiFi AttributesToJSON Processor. What is observed is that any key value pair is mapped to String datatype in the resultant JSON, which I believe is the intended behavior.
However, is there any known approaches to specify the datatype for a Key-Value pair? Currently I am employing an ExecuteScript processor once the JSON conversion is done to convert the "String" data type to whatever datatype I want the key-value to be in.
Are there other better approaches?
Created 01-30-2017 06:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a JIRA to improve AttributesToJson to support types besides strings:
https://issues.apache.org/jira/browse/NIFI-2359
Currently all flow file attributes are stored as strings so there needs to be a way for the user to indicate the type for each attribute. For example, if attribute "foo" has a value of "true" we don't really know if the user wants true as a boolean or true as a string.
A convention could be created where each attribute could have a corresponding type attribute so something like:
attr1 = true
attr1.type = boolean
attr2 = true
attr2.type = string
Created 01-30-2017 06:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a JIRA to improve AttributesToJson to support types besides strings:
https://issues.apache.org/jira/browse/NIFI-2359
Currently all flow file attributes are stored as strings so there needs to be a way for the user to indicate the type for each attribute. For example, if attribute "foo" has a value of "true" we don't really know if the user wants true as a boolean or true as a string.
A convention could be created where each attribute could have a corresponding type attribute so something like:
attr1 = true
attr1.type = boolean
attr2 = true
attr2.type = string
Created 01-30-2017 06:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Bryan Bende : Thanks for pointing the Jira.
