Ad Widget

Collapse

Parse JSON API with multiples value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Floflobel
    Junior Member
    • Dec 2019
    • 5

    #1

    Parse JSON API with multiples value

    Hello,

    I'm looking to parse a JSON API with zabbix to be able to monitor several informations. I managed to retrieve a valid JSON from the API and then retrieve only the values I want to preprocess with a HTTP Agent.

    The problem is, I would like that for each iteration (that I put a different color) it would create me a kind of LLD with several items in it that, I parse thanks to the preprocessing.

    Which would give me:
    * LLD with all of my JSON
    ** Item1: Retrieving the value "$.[]UserName"
    ** Item2: Retrieving the value "$.[].PlayState.PlayMethod"

    This for each of my iterations.

    Is it possible at the moment and how? I've been reading a lot of documentation and topics but without really finding the answer.

    Example of JSON API:
    [
    {
    "PlayState":{
    "CanSeek":false,
    "IsPaused":false,
    "IsMuted":false,
    "RepeatMode":"RepeatNone"
    },
    "AdditionalUsers":[

    ],
    "RemoteEndPoint":"192.168.1.65",
    "PlayableMediaTypes":[

    ],
    "PlaylistIndex":0,
    "PlaylistLength":0,
    "Id":"882ad891495df0fa96b",
    "ServerId":"5ac8f4c1bb8ce95",
    "LastActivityDate":"2019-12-26T21:33:40.4022233Z",
    "DeviceId":"5acb670f4c1bb8ce95",
    "ApplicationVersion":"v3",
    "SupportedCommands":[

    ],
    "SupportsRemoteControl":false
    },

    {
    "PlayState":{
    "PositionTicks":14732390136,
    "CanSeek":true,
    "IsPaused":false,
    "IsMuted":false,
    "VolumeLevel":100,
    "MediaSourceId":"bbf771181d7f",
    "PlayMethod":"DirectStream",
    "RepeatMode":"RepeatNone"
    },
    "AdditionalUsers":[

    ],
    "RemoteEndPoint":"192.168.1.66",
    "PlayableMediaTypes":[
    "Video",
    "Audio"
    ],
    "PlaylistIndex":0,
    "PlaylistLength":1,
    "Id":"23b8ec8c84d8",
    "ServerId":"5b8ce95",
    "UserId":"f5eb9",
    "UserName":"username",
    "LastActivityDate":"2019-12-26T21:33:40.3270277Z"
    },

    {
    "PlayState":{
    "PositionTicks":14732390136,
    "CanSeek":true,
    "IsPaused":false,
    "IsMuted":false,
    "VolumeLevel":100,
    "MediaSourceId":"1fb181d7f",
    "PlayMethod":"DirectStream",
    "RepeatMode":"RepeatNone"
    },
    "AdditionalUsers":[

    ],
    "RemoteEndPoint":"192.168.1.67",
    "PlayableMediaTypes":[
    "Video",
    "Audio"
    ],
    "PlaylistIndex":0,
    "PlaylistLength":1,
    "Id":"23bcafc8c84d8",
    "ServerId":"5ac670f4c1bb8ce95",
    "UserId":"f5e2dbaadf7d3b9",
    "UserName":"username2",
    "LastActivityDate":"2019-12-26T21:33:40.3270277Z"
    }

    ],
    Last edited by Floflobel; 27-12-2019, 15:56.
  • Floflobel
    Junior Member
    • Dec 2019
    • 5

    #2
    The problem has been solved using macro LLD with JSON Path preprocessing.

    Comment

    Working...