JSON Transformation Error


(Theo Sieber) #1

Sorry, I’m beginner.

Ive installed 2.3.0.001-SNAPSHOT on a synology NAS. Everything is working fine.
HTTP and JSON is installed.

I need the hole Json entry, I think with the following string item.
In the openhab.log file I recieve the following Warning. How can I fix this?

.items
String Worx_Return { http="<[http://:@/jsonDebug.cgi:10000:JSONPATH($.Array[(@.Length-1)])]" }

error message:
2018-05-01 23:20:04.597 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation ‘JSONPATH($.Array[(@.Length-1)])’ threw an exception. [response={“landroid”:{“state”:“home”,“boardTemperature”:19.1,“distance”:-12116,“wheelLeftDistance”:-24224,“wheelRightDistance”:-9,“angle”:-4204,“rainSensor”:3895,“aree”:{“index”:9,“vet”:[1,3,2,1,2,4,1,4,2,2]},“battery”:{“percentage”:100,“voltage”:27.48,“temperature”:16.3,“ntcResistance”:14045},“batteryCharger”:{“state”:“idle”,“chargeCurrent”:23.36},“accelerometer”:{“gravity”:[-0.019,0.072,1.024],“angle”:[0.000000,3.000000,0.000000]},“gyroscope”:{“angularSpeed”:[0.276,-0.028,2.904],“angle”:[1261821.125000,291128.000000,215772.031250]},“motor”:[{“speed”:0,“maxSpeed”:51,“speedReduction”:0,“rpm”:0,“feedbackError”:0,“acceleration”:100,“deceleration”:220,“fault”:false},{“speed”:0,“maxSpeed”:51,“speedReduction”:0,“rpm”:0,“feedbackError”:0,“acceleration”:100,“deceleration”:220,“fault”:false},{“speed”:0,“maxSpeed”:92,“speedReduction”:0,“rpm”:0,“feedbackError”:0,“acceleration”:100,“deceleration”:250,“fault”:false}],“guide”:{“straightSpeed”:0,“turningSpeed”:0,“measuredWheelDeltaDistance”:0,“requiredWheelDeltaDistance”:0,“deltaSpeedCorrection”:0}},“id”:{“stop1”:false,“stop2”:false,“lift1”:false,“lift2”:false,“trappedLeft”:false,“trappedRight”:false,“door1”:false,“door2”:false},“dipSw”:{“sw1”:false,“sw2”:false,“sw3”:false,“sw4”:false},“wireSensor”:{“fwVer”:0.70,“left”:“inside”,“right”:“outside”}}]
org.openhab.core.transform.TransformationException: An error occurred while transforming JSON expression.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [208:org.openhab.core.compat1x:2.3.0.201804291002]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [217:org.openhab.binding.http:1.12.0.201804291342]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [208:org.openhab.core.compat1x:2.3.0.201804291002]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [208:org.openhab.core.compat1x:2.3.0.201804291002]


(Vincent Regaud) #2

Your json is in the wrong format. It is using down quotes and up quotes. Instead it should be straight double quotes "
Is there anyway you can change that?
Other way will be to use a javascript transform


(Rich Koshak) #3

quote=“vzorglub, post:2, topic:44417”]
Your json is in the wrong format. It is using down quotes and up quotes. Instead it should be straight double quotes "
[/quote]

This is probably something done by the forum. It likes to make all of our posts look pretty by making little changes like this. This is why How to use code fences is so important.

@Tefi, please repost the log inside code fences so we can be certain that the JSON is properly formatted. It is also much easier to read.


(Vincent Regaud) #4

What value in the JSON are you after?