JSON Format Inconsistencies

Hello!

I like the JSON format option, and it makes parsing the data much cleaner and easier to convert into an OO language and use existing JSON tooling. However as I am writing my module/system I am noticing several inconsistencies. I started mapping the responses to objects based on the patterns, but then have found after testing that they don’t follow all the same rules. For a start some variables are snake_case, while others appear CamelCase (or lowerCamelCase).

Specifically I am looking at ListParticipantsResult right now. Some of the nested info (e.g. camera_status) just appear as prefixed keys, while the hand_status appears as a nested object (as you’d expect), as can be seen below:

{
  "audio_status state": "AUDIO_UNMUTED",
  "audio_status type": "AUDIO_VOIP",
  "avatar_url": "",
  "camera_status am_i_controlling": false,
  "camera_status can_i_request_control": false,
  "camera_status can_move_camera": false,
  "camera_status can_switch_camera": false,
  "camera_status can_zoom_camera": false,
  "can_edit_closed_caption": false,
  "can_record": false,
  "event": "None",
  "hand_status": {
    "is_valid: ": "off"
  },
  "isCohost": false,
  "is_client_support_closed_caption": false,
  "is_client_support_coHost": false,
  "is_host": false,
  "is_myself": true,
  "is_recording": false,
  "is_video_can_mute_byHost": true,
  "is_video_can_unmute_byHost": true,
  "local_recording_disabled": true,
  "user_id": 16779264,
  "user_name": "Dev Test Room",
  "user_type": "NORMAL",
  "video_status has_source": true,
  "video_status is_receiving": false,
  "video_status is_sending": true
}

Also some keys like is_video_can_mute_byHost are a mix of snake case and camel case!

I fully appreciate this API is quite vast, and it must’ve been a large amount of work to get to this stage. I just wanted to bring it up at least! It’s not causing me a specific issue really, except that translating it into a module is harder because I can’t assume any patterns based on the documented CLI responses.

Perhaps even having both CLI & JSON examples in the future would be a nice start. I will be capturing examples as I code and test and am happy to just share them if that’s helpful.

1 Like

Ben: Thanks for the feedback - we may consider doing something backwards-compatible in the next release to make things more consistent.

-Scott

Thank you. Along similar lines, I forgot to mention, is that boolean values seem to be represented in a few ways and are also a bit inconsistent. Most of them I have found say on/off in the documentation but, as in the example above, are actually true/false.

1 Like