- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi Remove double quotes in attribute value
- Labels:
-
Apache NiFi
Created ‎12-12-2017 12:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an EvaluateJsonPath processor which adds the client id as an attribute to a flow file, client id is an integer without any double quotes, but when I later retrieve this and few other attributes using a AttributeToJson processor and get the results as a JSON output I get the client ID with double quotes in the following format:
clientid : "2"
I tried with JOLTTransformJSON processor too with following configuration:
[ { "operation": "default", "spec": { "clientid":"${clientid}" } } ]
and also with the replace function in an updateAttribute processor to replace double quotes but still I get it with double quotes, how can I get rid of the double quotes in resultant JSON.
Created on ‎12-12-2017 01:40 PM - edited ‎08-17-2019 06:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After Attributes to Json processor use Replace Text processor with
Search Value
"clientid"\s+:\s+"(.*)"
Replacement Value
"clientid" : $1
Replacement Strategy
Regex Replace
Evaluation Mode
Entire text
Configs:-
Input:-
{ "clientid" : "2", "id":"1", "name":"HCC" }Output:-
{ "clientid" : 2, "id":"1", "name":"HCC" }
So we are searching for the value of client id and replacing the value without quotes by using replace text processor.
