Naveen The approach Matt suggested will help. Perhaps a more complete approach would be to be able to apply a true schema validation to JSON documents. I did a quick search for apache friendly Java libraries and found this [1]. Perhaps we should have a processor that lets users validate JSON documents using such an approach.
Do you think this could help you? Thanks Joe [1] https://github.com/everit-org/json-schema On Tue, Nov 10, 2015 at 8:35 PM, Matthew Clarke <[email protected]> wrote: > Sorry, the java regular expression should actually be [0-9]+ instead of > [0-9].* > > On Nov 10, 2015 4:57 PM, "Madhire, Naveen" <[email protected]> > wrote: >> >> Yes, this helps. I am not much familiar Nifi expressions. I found a good >> tutorial in Apache Nifi website. I am going through that now. >> >> Thanks Matt. >> >> From: Matthew Clarke <[email protected]> >> Reply-To: "[email protected]" <[email protected]> >> Date: Tuesday, November 10, 2015 at 3:11 PM >> To: "[email protected]" <[email protected]> >> Subject: Re: processor for validation >> >> Naveen, >> The NiFi expression language can be used to accomplish what you are >> looking to do. First extract the "customer_id" from the main message. Then >> used the routeonAttribute processor to only route files where the customer >> contains only numbers. >> >> ${'customer_id':matches('[0-9].*')} >> >> Without looking at your json messages, I can't be specific on the >> expression language statement to use to extract the customer_id. >> >> Does this help? >> >> Matt >> >> On Nov 10, 2015 3:46 PM, "Madhire, Naveen" <[email protected]> >> wrote: >>> >>> Hi, >>> >>> My requirement is to do validations of few json elements. For example, >>> One of the key in Json is customerid and I need to make sure “customer_id” >>> is always numeric. >>> >>> I looked at EvaluateJsonPath, but it is more of checking against an >>> expression. >>> So is there any processor which can be used for validations? >>> >>> >>> Thanks, >>> Naveen >>> >>> >>> >>> ________________________________ >>> >>> The information contained in this e-mail is confidential and/or >>> proprietary to Capital One and/or its affiliates and may only be used solely >>> in performance of work or services for Capital One. The information >>> transmitted herewith is intended only for use by the individual or entity to >>> which it is addressed. If the reader of this message is not the intended >>> recipient, you are hereby notified that any review, retransmission, >>> dissemination, distribution, copying or other use of, or taking of any >>> action in reliance upon this information is strictly prohibited. If you have >>> received this communication in error, please contact the sender and delete >>> the material from your computer. >> >> >> ________________________________ >> >> The information contained in this e-mail is confidential and/or >> proprietary to Capital One and/or its affiliates and may only be used solely >> in performance of work or services for Capital One. The information >> transmitted herewith is intended only for use by the individual or entity to >> which it is addressed. If the reader of this message is not the intended >> recipient, you are hereby notified that any review, retransmission, >> dissemination, distribution, copying or other use of, or taking of any >> action in reliance upon this information is strictly prohibited. If you have >> received this communication in error, please contact the sender and delete >> the material from your computer.
