Skip to content

Ability to grab values from outside over context. #109

Open
@jmcnevin

Description

I'm attempting to transform a document like this:

{
  "first_name": "John",
  "last_name": "Doe",
  "children": [{ "first_name": "Jack" }, { "first_name": "Jane" }]
}

Into something like this:

[
  {
    "first_name": "Jack",
    "last_name": "Doe"
  },
  {
    "first_name": "Jane",
    "last_name": "Doe"
  }
]

This would take the children's first names and combine them with the parent's last name. I'm not sure if this can be done currently without some way of escaping the context created by using over, like this (borrowing from syntax I've seen in JSONata):

{
  "operation": "shift",
  "spec": {
    "first_name": "first_name",
    "last_name": "$$.last_name"
  },
  "over": "children"
}

This would be a nice feature to have, unless some other solution is possible.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions