Why are Functions and Variables treated differently in JSON?

SO,

I have been playing with the cloud API and writing my own Labview interface. During my experiments I noticed that in the JSON device report Functions are returned in a nice array, while Variables are not.

Can anyone explain to me why this would be the case? pulling the Variables out has turned out to be much more difficult than the Functions.

Sample JSON report below.

{
  "id": "id",
  "name": "jons_button",
  "last_app": null,
  "last_ip_address": "75.130.249.58",
  "last_heard": "2016-05-19T23:58:02.647Z",
  "product_id": 6,
  "connected": true,
  "platform_id": 6,
  "cellular": false,
  "status": "normal",
  "variables": {
    "var1": "int32",
    "var2": "int32"
  },
  "functions": [
    "digitalread",
    "digitalwrite",
    "analogread",
    "analogwrite"
  ],
  "cc3000_patch_version": "wl0: Nov  7 2014 16:03:45 version 5.90.230.12 FWID 01-5a282cf"
}

Functions only show the name, whereas the variables also have a datatype associated with it, hence the extra field. Extracting the JSON shouldn’t be that much more difficult though.

sure, but it would be so much more convenient if those variables were returned in 2-deep array, instead of elements.

to unflatten JSON in labview (at least with the built in functions) require that you know the element name ahead of time. Since these are variables, you may not know the variable names, you could be performing a device discovery for example.

Functions get around this by returning as an array, so I pull those no problem.

if the variables were returned like this:

“variables”: [
“var1”: “int32”,
“var2”: “int32”
],

instead of like this

“variables”: {
“var1”: “int32”,
“var2”: “int32”
},

my life would be so much easier!

I ended up creating my own parser to pull variable names, but I am sure there must be a better way.

I cant be the first person to wonder about this, which is why i asked the original question.