Hello,
I haven't tested myself, but using EvaluateJsonPath and ReplaceText
with 'unescapeJson' EL function may be an alternative approach instead
of Jolt.
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#unescapejson
Idea is, use EvaluateJsonPath to extract the MSG part into a FlowFile
attribute, e.g. 'message'.
Then use ReplaceText with 'Replacement Value' as
"${message:unescapeJson()}" to update FlowFile content with the normal
JSON representation.
Thanks,
Koji
On Thu, Mar 7, 2019 at 5:18 AM l vic <[email protected]> wrote:
>
> I have json message that contains another json message in textual form:
> {
> "one": "one".
> "two":2,
> "MSG": "{\"src\":\"my source\",\"priority\":\"0\"}"
> }
>
> What would be transform spec to get "contained" message in json ?
> {
> "src": "my source",
> "priority": "0"
> }
>
> I've tried the following spec:
> [
> {
> "operation": "shift",
> "spec": {
> "MSG": {
> "*": "&"
> }
> }
> }
> ]
> but ended up with just text message:
> { "MSG": "{\"src\":\"my source\",\"priority\":\"0\"}"}
> How should i change it?
> Thank you
>