I think you could accomplish this using ConvertRecord. For the Record Reader, 
use a CSVReader with the delimiter character set to |, and for the Record 
Writer, use a JsonRecordSetWriter. You may have to use a 
ScriptedRecordSetWriter to parse the key/value pair tokens out individually. 


Andy LoPresto
[email protected]
[email protected]
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Nov 6, 2019, at 9:24 AM, Chandrashekhar Kotekar 
> <[email protected]> wrote:
> 
> I would prefer to write custom processor which will first convert those key 
> value pairs into Properties object and then map that object to POJO and use 
> json4s to convert pojo to JSON. 
> 
> Sent from my iPhone
> 
>> On 6 Nov 2019, at 9:13 pm, Rivasa <[email protected]> wrote:
>> 
>> Hi, so I'm having a bit of trouble where I can't really figure out how to
>> accomplish what I need, since i'm fairly new to NIFI in general.
>> 
>> So I have a string in the following format:
>> item1=value1|item2=value2|item3=value3|item4=value4... so on and so forth. 
>> 
>> What I would like to do is convert this into a valid JSON object of the
>> format of:
>> {
>> "item1":"value1", 
>> "item2":"value2",
>> "item3":"value3",
>> "item4":"value4"
>> ...
>> etc
>> }
>> 
>> I think I need to use extract text or similar maybe? But I'm not exactly
>> sure what to do. Could someone point me in the right direction?
>> 
>> 
>> 
>> --
>> Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/

Reply via email to