Unable to handle data from Json array

Avatar
  • updated
  • Under review

When using the http driver, I am able to connect to an API and process the Json data. For example:

{

       "id": 60662,

       "country": "NL",

        "main": true

}


But when the data is returned in a Json array, the data cannot be parsed! For example, the folowing respons cannot be handled by Comfortclick:


[

  {

       "id": 60662,

       "country": "NL",

        "main": true

   }

]


or


[

  {

       "id": 60662,

       "country": "NL",

        "main": true

   },

  {

       "id": 906428

       "country": "UK",

        "main": false

   }

]


When will support for Json array's be implemented? A lot of sites are returning Json data within an array nowedays.


Or is there an other workarround to process Json data within an array?

Avatar
Joachim O

I was able to work around it using regex, but this was better. Thanks 👍

Anyone knows if websocket subscription is possible? It would enable many features in the API I'm exploring

Avatar
Bao Tran
Quote from Joachim O

I'm facing a problem parsing an array.

I have this repsonse:

Image 5453

Trying to fetch the locationID token like this:

Image 5454

But i get nothing. Any ideas?

use : Array[0].locationID

Avatar
Joachim O

I'm facing a problem parsing an array.

I have this repsonse:

Image 5453

Trying to fetch the locationID token like this:

Image 5454

But i get nothing. Any ideas?

Avatar
Sebastian Salmhofer

Hi,

are you still planing on implementing support for json arrays? I could use it to.

Sebastian

Avatar
Calin Birtocean

Hi Pascal,

Use this as an example:

  "DeviceList": [

    {

  "identifier": "5118234654675119",

      "name": "EXAMPLE",

.....

Add a string, for the token name use: DeviceList[0].name

the value you should get is: EXAMPLE

Regards,

Calin

Avatar
ComfortClick Support
  • Under review

Hello,


currently, bOS does not quite support these json arrays, however you can try our workaround. Best way for you to test if it works is, to download our Foobot example (in our examples : https://www.comfortclick.com/Software/Examples# ) and see if you can use the same principle in your case.


Best regards.