Skip to content

How to do the array to array shift #206

@JeffSG

Description

@JeffSG

hi there,

Could anyone help to show me how to do an array to array shift?
For example, the input Json is

{
  "students": [
    {"id":"1", "score":"5"},
    {"id":"2", "score":null}
  ]
}

And the expected output Json is

{
  "level1": {
    "level2": [
      {"number":"1", "score":"5"},
      {"number":"2", "score":null}
    ]
  }
}

How to write the shiftr spec?

Furthermore, is it possible to output only array element of which "score" is not null?

Thanks in advance.

Regards,
Jeff

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions