Parsing nested json


Author
Message
tucan
tucan
New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)
Group: Forum Members
Posts: 1, Visits: 9
Hi, we have nested json logfiles from our own equipment and I am trying to generate a parser using the wizard to handle them. If I remove the json root level from my log file manually then I can get the parser to work well, it correctly recognises the elements in the json. However this means manually editing the log file before feeding it to LVP, which kind of defeats the object .
So, how can I automatically ignore the json 'header' and 'result' sections in the sample below and only process the nested 'events' elements?


{
  "request": "/api/v1/events?date=2022-01-29",
  "responding_controller": {
   "name": "Location",
   "ip_address": "10.10.18.203",
   "serial_number": "0400430",
   "firmware_version": "3",
   "firmware_commit": "923cb3 (clean)"
  },
  "result": {
   "result_code": "0",
   "result_desc": "OK",
   "result_datetime": "2022-01-30T07:59:45.000+03:00"
  },
  "events": [
   {
    "id": 143455,
    "transition_type": "raised",
    "timestamp": "2022-01-29T04:14:35.000+03:00",
    "status": {
      "current_status": "active",
      "scope": "a_master",
      "name": "control.from",
      "status_type": "output_channel",
      "entity_type": "output_card",
      "entity_id": 3,
      "sub_entity_id": 8
    }
   },
   {
    "id": 143456,
    "transition_type": "raised",
    "timestamp": "2022-01-29T04:14:35.000+03:00",
    "status": {
      "current_status": "active",
      "scope": "a_master",
      "name": "AMP5 CH4",
      "status_type": "line_short",
      "entity_type": "amplifier",
      "entity_id": 20,
      "sub_entity_id": 0
    }
   }
  ]
}
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Login

Explore
Messages
Mentions
Search