Re: Suggestion for a new Expression Language method

2022-10-14 Thread Mike Thomsen
It would be something like this: ${ff_attr:isJson()} So it should be a boolean. On Fri, Oct 14, 2022 at 10:27 AM Dan S wrote: > > I am looking to add isJson to the Apache NiFi Expression Language Guide > > but > I am

Re: Suggestion for a new Expression Language method

2022-10-14 Thread Dan S
I am looking to add isJson to the Apache NiFi Expression Language Guide but I am not sure what category of functions this would fall under. I was thinking perhaps under Boolean Logic or Searching. Does that make sense or

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Mike Thomsen
NP. I'd recommend riffing on something like isNull. Should be a pretty easy ticket. Tag me in the review. On Fri, Oct 7, 2022 at 12:19 PM Dan S wrote: > > Mike, > I know you could raise a PR quickly but if you do not mind, I am still > getting my feet wet with NIFI development so I would like

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Dan S
Mike, I know you could raise a PR quickly but if you do not mind, I am still getting my feet wet with NIFI development so I would like to take a crack at implementing this. Thanks! On Fri, Oct 7, 2022 at 12:07 PM David Handermann < exceptionfact...@apache.org> wrote: > Dan, > > That comment

Re: Suggestion for a new Expression Language method

2022-10-07 Thread David Handermann
Dan, That comment appears to be historical. The current ObjectMapper documentation indicates that instances are thread safe as long as all configuration is completed before read or write operations:

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Dan S
Mike, I noticed you did similar work in NIFI-5271 . Joe Witt commented there > We dont have guaranteed thread safety until the jackson 3.0 release. Has that changed? On Fri, Oct 7, 2022 at 11:55 AM Mike Thomsen wrote: > To do it right, you

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Mike Thomsen
To do it right, you want to use a tool like Jackson or Gson to do a test parse after you've detected open and close statements that seem to be JSON open and close statements. On Fri, Oct 7, 2022 at 11:38 AM Dan S wrote: > > Mike, > What do you mean by "this might be a somewhat heavy method so

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Dan S
Mike, What do you mean by "this might be a somewhat heavy method so be careful." ?

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Mike Thomsen
I think this would be a fairly easy lift because Jackson's ObjectMapper in 2.X is thread safe. We'd just need to put a warning in the documentation saying "this might be a somewhat heavy method so be careful." I can make a PR for this pretty quickly. On Fri, Oct 7, 2022 at 11:11 AM David

Re: Suggestion for a new Expression Language method

2022-10-07 Thread David Handermann
Hi Dan, It seems like this could be helpful, although accurate detection might be difficult. It could be as simple as checking whether a string starts with a curly bracket or square bracket character. Another option would be attempting to parse the string using a JSON library, since that could

Re: Suggestion for a new Expression Language method

2022-10-07 Thread Pierre Villard
Hi Dan, I personally think this is a fair addition to the expression language options we have. Feel free to file a JIRA and submit a pull request if you'd like to do so. Thanks, Pierre Le ven. 7 oct. 2022 à 08:34, Dan S a écrit : > My team has flow file attributes which we do not always know

Suggestion for a new Expression Language method

2022-10-07 Thread Dan S
My team has flow file attributes which we do not always know whether they are JSON or not. We would like to run JsonPath on them but when they are not JSON we get flow files yielding as detailed in NIFI-10396 . I understand the reasons given there