What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Parse JSON Array

Votes:

0

Hi

I need to parse the following JSON array:

[{"Tilstand":"Slukket "},{"Alarm":"Ingen"}]

...but I'm getting the error: Data at the root level is invalid. Line 1, position 1.

The data is valid JSON according to the online validators...

I need to parse the key "Alarm" to get the value "Ingen".

Is this currently possible?

json parse sensor

Created on Feb 26, 2012 8:05:08 PM



2 Replies

Votes:

0

Dear Lars,

presuming you want to do this with the HTTP/XML Rest-Sensor, which is able to check JSON, the JSON needs to start with { and end }. So it needs to be like

{
"Tilstand":"Slukket ",
"Alarm":"Ingen"
}

or

{ 
"my_array": 
[{"Tilstand":"Slukket "},{"Alarm":"Ingen"}]
}

Created on Feb 27, 2012 2:30:57 PM by  Torsten Lindner [Paessler Support]



Votes:

0

This seems broken. It is perfectly valid JSON to start with an array at the root level. We currently cannot monitor RabbitMQ as a result of this prtg issue.

Created on Sep 26, 2012 2:59:06 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.