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

Adding a property between other properties in a JSON object #1221

Open
estigma88 opened this issue Oct 4, 2023 · 0 comments
Open

Adding a property between other properties in a JSON object #1221

estigma88 opened this issue Oct 4, 2023 · 0 comments

Comments

@estigma88
Copy link

Hi everyone, I would like to add a property between other properties in a JSON object.

Input:

{
  "f1": "v1",
  "f3": "v3"
}

Expected output:

{
  "f1": "v1",
  "f2": "v2",
  "f3": "v3"
}

The original JSON should be kept as it is. Also, this case could go beyond, for instance, trying to add a new property in the third position, as follows:

Input:

{
  "f1": "v1",
  "f2": "v2",
  "f3": "v3"
}

Output:

{
  "f1": "v1",
  "f2": "v2",
  "f2.1": "v2.1",
  "f3": "v3"
}

There, the property f2.1 was added as 3th element in the JSON object.

Not sure how to build a JOLT transformation for that, so, any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant