Hi.
I’ve managed after much work, to get a data capture from my solar device into Hubitat Code but I can’t get it to format it in json. It comes out like this:-
As @tomw mentioned, you may be able to use it directly. Also, I have found this site useful for checking out json responses for formatting or looking at large responses for relevant data: http://jsonviewer.stack.hu/
The groovy map operations don’t work on this format and it want to extract the values to use in a device.
I haven’t used jsonslurper before but will take a look at your link. Thanks.
So I’m not clever enough to fully understand how to use the slurper. When I use If I use textParser as below:-
def slurper = new JsonSlurper()
def result = slurper.textParser(response)
Then I get an error - Preformatted textdev:6102020-10-19 08:21:15.780 warnError: No signature of method: groovy.json.JsonSlurper.textParser() is applicable for argument types: (groovyx.net.http.HttpResponseDecorator) values: [groovyx.net.http.HttpResponseDecorator@13f0ac6]Preformatted text
Is there some other part of the slurper I should be trying.
That is curious, since it looked similar to traces of pre-parsed Json maps that I have seen in my drivers. Can you give a snippet of code and log/error output to show how exactly it was not working? It may help narrow down some of the guessing as to what is going wrong.
Here is an example for how it might work (shown with an actual http operation for context):
Great! Could you share some code and what the missing pieces were to get it working? I'm genuinely curious, and it may be useful to others with similar challenges.