You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Eric Chaves <er...@uolet.com> on 2017/10/08 22:38:35 UTC

Parsing stringified json content

Hi, I'm writing a flow to handle SNS notification messages received through
HTTP. Those messages are JSON content whose Message attribute is an
stringified JSON text.

How can I parse this content into a new flow file?

Thanks in advance,

Eric

Re: Parsing stringified json content

Posted by Eric Chaves <er...@uolet.com>.
Hi James, thanks for the help!

2017-10-09 0:31 GMT-03:00 James Wing <jv...@gmail.com>:

> Eric,
>
> You can use the EvaluateJsonPath processor to extract the SNS message body
> using a JSON path of "$.Message".  As part of evaluating the path, it will
> un-escape the stringified content of Message and return the enclosed JSON
> content.
>
> If you want this to be in a new, separate flowfile from the original SNS
> body, I recommend duplicating the flowfile upstream of EvaluateJsonPath.
> It is easy to update the flowfile content to the "Message" content with
> EvaluateJsonPath by setting the Destination property to flowfile-content.
>
> Thanks,
>
> James
>
>
> On Sun, Oct 8, 2017 at 3:38 PM, Eric Chaves <er...@uolet.com> wrote:
>
>> Hi, I'm writing a flow to handle SNS notification messages received
>> through HTTP. Those messages are JSON content whose Message attribute is an
>> stringified JSON text.
>>
>> How can I parse this content into a new flow file?
>>
>> Thanks in advance,
>>
>> Eric
>>
>
>

Re: Parsing stringified json content

Posted by James Wing <jv...@gmail.com>.
Eric,

You can use the EvaluateJsonPath processor to extract the SNS message body
using a JSON path of "$.Message".  As part of evaluating the path, it will
un-escape the stringified content of Message and return the enclosed JSON
content.

If you want this to be in a new, separate flowfile from the original SNS
body, I recommend duplicating the flowfile upstream of EvaluateJsonPath.
It is easy to update the flowfile content to the "Message" content with
EvaluateJsonPath by setting the Destination property to flowfile-content.

Thanks,

James

On Sun, Oct 8, 2017 at 3:38 PM, Eric Chaves <er...@uolet.com> wrote:

> Hi, I'm writing a flow to handle SNS notification messages received
> through HTTP. Those messages are JSON content whose Message attribute is an
> stringified JSON text.
>
> How can I parse this content into a new flow file?
>
> Thanks in advance,
>
> Eric
>