Exception : Error reading JObject from JsonReader. Current JsonReader item is not an object

Avatar
  • updated
  • Under review

I have an http response like:

[{"1":"WiBee - Reset Energy Counters","v":true},{"1":"WiBee - Phase 1 Voltage","v":232.48},{"1":"WiBee - Phase 2 Voltage","v":225.12},{"1":"WiBee - Phase 3 Voltage","v":228.64}]

I have used the token name [1].v to get the Phase 1 Voltage but i always get an error 

Debug : 20/1/20 6:37:20 μμ : Devices\GetEnergyMeterData\FetchDataFromLM : Exception : Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1. ...

Any help?

Avatar
Ricardo Pinto

Hi,

In fact, if I load the response on a JSONPath Expression Tester (e.g. https://jsonpath.curiousconcept.com/), I get the correct value with the [1].v token

Do you have the correct parser type set?

Can you test with .[1].v ?

Avatar
George Tsamis

Hi,

I know the path is correct but i always get the same error and no value.

I laso tried .[1].v [2].v .[2].v and datatype string with the same token names without any luck

check attached screenshots if i am missing something

Avatar
Ricardo Pinto


Hi,

Can you tell us which configurator version you're using?

On a previous version, it seems that http devices with authentication we're having some problems. Can you check that and tell us?

Best regards

Avatar
George Tsamis

Hi,

Sorry for late reply.

Configurator version is 4.6.26

Avatar
Koerthe

Hi, 

Is there an answer/solution on this? I have the same error.

I'm already searching for a few days for this. Same error as above. But i can't manage to get a value out of it. 

If i check the link for the expression tester mentioned above, i can have the desired values out. But if i put this in the token name, i get the error that the jsonreader item is not an object. 

Can someone help please?

Avatar
Ricardo Pinto

Hi,

In fact, no one answered about this issue yet from bOS team.

I've tested the original http response that was posted by George Tsamis, and using a JSON parser / validator, the token gets the correct data.

I'm not sure if this can be a code problem from bOS. That needs to be confirmed by bOS team. I've searched about the error, which is actually a .NET / C# error, and all of the references I've found was about something wrong on the code, that's not correctly written to extract the correct value on the JSON array or something like that.

Let's wait for someone from bOS team to have a look at this post. If not, open a ticket please.

Best regards

Avatar
ComfortClick Support
  • Under review

Hello,

this issue has been resolved with our new update. You can test it out by installing BETA version. Than you will be able to parse out the main array using token: Array[#].X e.g. (Array[1].v)

Best regards,