Skip to content

Change Library Search "Revisions" from Object to Array #95

Closed
@GItThatSparrow

Description

@GItThatSparrow

Following on standard Story syntax, here...

AS A User
I NEED TO easily deserialize JSON into Objects
SO THAT I do not need to write custom transformation code


Overview

I want to deserialize the response from a command. Currently, the format of the response presents a problem when trying to create an array of objects.

Take this command, for example:

arduino-cli lib search yun --format=json

The response has the libraries > [n] > Releases property is an Object, not an Array, as seen here....

{
  "libraries":[
    {
      "Name":"SpacebrewYun",
      "Releases":{
        "1.0.0":{
          "Author":"Julio Terra",
          "Version":"1.0.0",
          /* ...additional properties */
        },
        "1.0.1":{
          "Author":"Julio Terra",
          "Version":"1.0.1",
          /* ...additional properties */
        }
      }
    },
    {
      "Name":"Ubidots Arduino YUN",
      "Releases":{
        "2.0.0":{
          "Author":"Ubidots Devel Team \u003cdevel@ubidots.com\u003e",
          "Version":"2.0.0",
          /* ...additional properties */
        }
      }
    }
  ]
}

Ideally, for deserialization, the Releases property would be an Array, like this...

{
  "libraries":[
    {
      "Name":"SpacebrewYun",
      "Releases":[
        {
          "Author":"Julio Terra",
          "Version":"1.0.0",
          /* ...additional properties */
        },
        {
          "Author":"Julio Terra",
          "Version":"1.0.1",
          /* ...additional properties */
        }
      ]
    },
    {
      "Name":"Ubidots Arduino YUN",
      "Releases":[
        {
          "Author":"Ubidots Devel Team \u003cdevel@ubidots.com\u003e",
          "Version":"2.0.0",
          /* ...additional properties */
        }
      ]
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions