All, 

I could also see that it would be useful additional configuration to 
AttributesToJson to defeat the escaping where the user knows the attribute 
contains literal JSON.



On 4/25/16, 1:50 PM, "McDermott, Chris Kevin (MSDU - STaTS/StorefrontRemote)" 
<chris.mcderm...@hpe.com> wrote:

>Igor,
>
>I think the jsonPath extension to the EL is going to be the ticket [1].  A 
>patch is available if you are willing to build NiFi yourself to test it out.
>
>Cheers,
>Chris
>
>[1] https://issues.apache.org/jira/browse/NIFI-1660
>
>
>From: Igor Kravzov <igork.ine...@gmail.com<mailto:igork.ine...@gmail.com>>
>Reply-To: "users@nifi.apache.org<mailto:users@nifi.apache.org>" 
><users@nifi.apache.org<mailto:users@nifi.apache.org>>
>Date: Monday, April 25, 2016 at 11:45 AM
>To: "users@nifi.apache.org<mailto:users@nifi.apache.org>" 
><users@nifi.apache.org<mailto:users@nifi.apache.org>>
>Subject: Re: ReplaceText processor configuration help
>
>Aldrin,
>
>The overall goal is to extract some subset of attributes from tweet's JSON, 
>create a new JSON and ingest it into Elasticsearch for indexing.
>Hope this helps.
>
>On Mon, Apr 25, 2016 at 11:18 AM, Aldrin Piri 
><aldrinp...@gmail.com<mailto:aldrinp...@gmail.com>> wrote:
>Igor,
>
>Thanks for the template.  It looks like the trouble is with AttributesToJSON 
>converting the attribute, which in your case, is a JSON blob, into additional 
>JSON and thus the escaping to ensure nothing is lost.  Are you just trying to 
>get that entity body out to a file?  If so, the AttributesToJSON is likely not 
>needed and you should be able to use something like ReplaceText to write the 
>attribute to the FlowFile body.  Please let us know your overall goal and we 
>can see if the right mix of components already exists or if we are running 
>into a path that may need some additional functionality.
>
>Thanks!
>Aldrin
>
>
>
>On Mon, Apr 25, 2016 at 10:33 AM, Igor Kravzov 
><igork.ine...@gmail.com<mailto:igork.ine...@gmail.com>> wrote:
>Hi Aldrin,
>
>
>Attached please find the template.  In this workflow I want to pull "entities" 
>and "user" entries for Twitter JSON as entire structure. I only can do it if I 
>set Return Type as JSON.
>Subsequently I use AttributesToJSON to create a new JSON file. But returning 
>values for "entities" and "user" are escaped so I had to clean these before 
>converting to JSON.
>
>Hope this helps.
>
>On Mon, Apr 25, 2016 at 10:15 AM, Aldrin Piri 
><aldrinp...@gmail.com<mailto:aldrinp...@gmail.com>> wrote:
>Hi Igor,
>
>That should certainly be possible.  Would you mind opening up a ticket 
>(https://issues.apache.org/jira/browse/NIFI) and providing a template of your 
>flow that is causing the issue?
>
>Thanks!
>
>On Mon, Apr 25, 2016 at 10:09 AM, Igor Kravzov 
><igork.ine...@gmail.com<mailto:igork.ine...@gmail.com>> wrote:
>Thanks Pierre. It worked. Looks like I was doing something wrong inside my 
>workflow.
>Would not be it feasible to have an option for EvaluateJsonPath processor to 
>have an option to return escaped or unescaped JSON result?
>
>On Mon, Apr 25, 2016 at 7:20 AM, Pierre Villard 
><pierre.villard...@gmail.com<mailto:pierre.villard...@gmail.com>> wrote:
>Hi Igor,
>
>Please use ReplaceText processors.
>
>1.
>Search value : \\
>Replace value : Empty string set
>
>2.
>Search value : "\{
>Replace value : \{
>
>3.
>Search value : \}"
>Replace value : \}
>
>Template example attached.
>
>HTH
>Pierre
>
>
>2016-04-24 20:12 GMT+02:00 Igor Kravzov 
><igork.ine...@gmail.com<mailto:igork.ine...@gmail.com>>:
>
>I am not that good in regex. What would be the proper configuration to do the 
>following;
>
>  1.  Remove backslash from text.
>  2.  Replace "{ with {
>  3.  replace }" with }
>
>Basically I need to clean escaped JSON.
>
>Like before:
>
> "{\"hashtags\":[{\"text\":\"Apple\",\"indices\":[45,51]}],\"urls\":[{\"url\":\"\",\"expanded_url\":\"\",\"display_url\":\"owler.us/abdLas\<http://owler.us/abdLas%5C>",\"indices\":[64,87]}],\"user_mentions\":[],\"symbols\":[{\"text\":\"AAPL\",\"indices\":[88,93]}]}",
>
>after:
>
>{"hashtags":[{"text":"Apple","indices":[45,51]}],"urls":[{"url":"","expanded_url":"","display_url":"owler.us/abdLas<http://owler.us/abdLas>","indices":[64,87]}],"user_mentions":[],"symbols":[{"text":"AAPL","indices":[88,93]}]},
>
>Thanks in advance.
>
>
>
>
>
>

Reply via email to