- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to remove ETX character from json value ?
- Labels:
-
Apache NiFi
Created 11-09-2022 06:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I could not split a JSON due to a special ETX character existing in a JSON value, SplitJson processor returns an error that it is not a Valid JSON.
The JSON looks like that:
[ {"key_data":"val_data"},
{"key_data":"val_ETXdata"},
{"key_data":"val_data"},
{"key_data":"val_data"},... ]
I used The next regex expression to replace it but it doesn't work:
\x03(?=[^"]*")
Created 11-09-2022 08:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I think you are having an issue because you have carriage return (\r\n) in the json , try using regex replace for the following as well: [\r\n]
Hope that helps, if it does please accept solution.
Thanks
Created on 11-09-2022 08:41 AM - edited 11-09-2022 08:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it is not the problem, the problem is due to the EXT symbol, \n\r\t\" am filtering them in other processors, Am filtering more than 10000 JSON files the error happens only with 4 files that contain ETX.
Created 11-09-2022 01:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you send me a sample json data with the error. The one you posted seems to be valid and Im able to split it .
Created on 11-10-2022 02:21 AM - edited 11-10-2022 02:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
share please your email
Created on 11-10-2022 08:14 AM - edited 11-10-2022 08:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried the follow pattern on the sent file and it worked: [\x03]+
Created 11-10-2022 08:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried both solutions
I got this error
Failed to process session due to null; Processor Administratively Yielded for 1 sec: java.nio.BufferOverflowException
Created on 11-10-2022 11:26 AM - edited 11-10-2022 11:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you share the configuration for the ReplaceText Processor? Also how big is the jsonfile?
Created 11-10-2022 11:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
properties are the same as in the picture you have shared.
Created 11-10-2022 12:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure how big is your Json and if its well formatted into multiple line. Make sure you have the Evaluation Mode is set to Line-by-Line , also you can increase the Maximum Buffer Size incase the text processed is greater than 1MB. Also what version of Nifi are you using ? there seems to be a bug around that as well where the flowfile will remain in the upstream queue and the overflow error is thrown: https://issues.apache.org/jira/browse/NIFI-10154
