Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce a moveField jsonata function #126

Closed
aeberhart opened this issue Mar 18, 2022 · 2 comments
Closed

introduce a moveField jsonata function #126

aeberhart opened this issue Mar 18, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@aeberhart
Copy link
Contributor

quite often, we need to "move" fields like this:

{
  x: 1,   ---- move this
  arr:[
    { ... },    --in here
    { ... }    --and in here
  ]
}

The command could be:

$moveField($, "x", "arr")

The "normal" jsonata way would be to use a variable / the parent operator in conjunction with $merge which can be a bit lengthy

@aeberhart
Copy link
Contributor Author

if "arr" is a regular object this must work as well of course

@aeberhart
Copy link
Contributor Author

$flatten already does something similar

@aeberhart aeberhart self-assigned this Mar 21, 2022
@aeberhart aeberhart added the enhancement New feature or request label Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant