JSONPath Expression Needed

27 views
Skip to first unread message

Elie Hanna

unread,
Oct 22, 2017, 6:44:07 PM10/22/17
to OpenRemote
Hello All,

Please I need a help to extract the power stat value from the JSON Expression below after i send a HTTP request so i get this message as result:


RESULT = {"POWER":"ON"}
POWER1 = ON


The word "RESULT = " is the main problem so when I try to write POWER in JSONPath Expression to parse the power state value I got an error. I deleted the "RESULT =" and tried the JSONPath with an online extractor it works but am not able to get an HTTP reply without the "RESULT =".


Thank you in advance.


Regards,

Michal Rutka

unread,
Oct 27, 2017, 6:19:13 AM10/27/17
to OpenRemote
Hi,

as the result is not a valid JSON it would be hard to use JSONPath expression to parse it. However, it is easy to extract the information with a regular expression. The following one should do the job:

:"(\w+?)"

You can test and develop regular expressions on the site http://www.regexplanet.com/advanced/java/index.html

Kind regards,
Michal

Elie Hanna

unread,
Oct 28, 2017, 5:40:30 AM10/28/17
to OpenRemote
Thank you very much Michal, Done !!
Reply all
Reply to author
Forward
0 new messages