Hong,

I was able to use EvaluateJsonPath with eventClass $.event.@class and the
attribute had the correct value (see output from LogAttribute below):

--------------------------------------------------
Standard FlowFile Attributes
Key: 'entryDate'
Value: 'Tue Mar 29 08:41:36 EDT 2016'
Key: 'lineageStartDate'
Value: 'Tue Mar 29 08:41:36 EDT 2016'
Key: 'fileSize'
Value: '932'
FlowFile Attribute Map Content
Key: 'eventClass'
Value: 'events.policy.PolicyCreated'
Key: 'filename'
Value: 'test.json'
Key: 'path'
Value: './'
Key: 'uuid'
Value: '174e1add-0411-41a4-b7f5-7a43360ad104'
--------------------------------------------------

What version of NiFi are you using? I used 0.6.0 to get the above results,
perhaps there was a bug that was fixed?

Regards,
Matt


On Tue, Mar 29, 2016 at 4:30 AM, Hong Li <[email protected]>
wrote:

> How can I assign the value of a Json field that has a name starting with @
> as the first character of its name to a user-defined-property in
> EvaluateJsonPath?
>
> For example, I have the following sample Json message:
>
> {
> "effectiveTimestamp": "2015-12-03T23:17:29.874Z",
> "event": {
>
>> "@class": "events.policy.PolicyCreated",
>
> "id": "1e9b91398160471f8b6197ad974e2464",
> "ipAddress": "10.8.30.145",
> "policy": {
> "additionalListedInsureds": [],
> "address": {
> "city": "Skokie",
> "county": "Cook",
> "id": "b863190a5bf846858eb372fb5f532fe7",
> "latitude": 42.0101,
> "longitude": -87.75354,
> "state": "IL",
> "street": "5014 Estes Ave",
> "zip": "60077-3520"
> },
> "applicant": {
> "age": 36,
> "birthDate": "1979-01-12",
> "clientId": "191",
> "creditReport": {
> "id": "ca5ec932d33d444b880c9a43a6eb7c50",
> "reasons": [],
> "referenceNumber": "15317191300474",
> "status": "NoHit"
> },
> "firstName": "Kathy",
> "gender": "Female",
> "id": "1f4a3862fab54e058305e3c73cc13dd3",
> "lastName": "Bockett",
> "maritalStatus": "Single",
> "middleName": "Sue",
> "ssn": "*******"
> },
> "channelOfOrigin": "PublicWebsite",
> ... ...
>
> Under EvaluateJsonPath, I can make
>
> eventID = $.event.id
>
>
> But I found out that if I make
>
>            eventClass = $.event.@class
>
> the value of @class will never be assigned to eventClass.
>
> How should we capture the value of such a Json field?
>
> Thanks.
> Hong
>
>
> *Hong Li*
>
> *Centric Consulting*
>
> *In Balance*
> (888) 781-7567 office
> (614) 296-7644 mobile
> www.centricconsulting.com | @Centric <https://twitter.com/centric>
>

Reply via email to