0

my goal is to map a JSON object into as value in a new JSON object key. Such as example:

My starting JSON:

{
 "old_key_1" : "some_json_structure_1",
 "old_key_2" : "some_json_structure_2",
 "old_key_3" : "some_json_structure_3"
}

My goal JSON:

{
 "new_key_1" : 
  {
    "old_key_1" : "some_json_structure_1",
    "old_key_2" : "some_json_structure_2",
    "old_key_3" : "some_json_structure_3"
  }
}

How is it possible using JOLT: if I understand well I have to use a shift spec but I didn't understand how?

Can anyone can help me?

Thank you in advance

1 Answer 1

3

Wrapping into new object:

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "@": "new_key_1.&" //the "&" means go up the tree 0 levels, grab what is there and subtitute it in
      }
    }
  }
]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Magda. It worked: I got this solution before but I forgot to put the solution in the question. So thanks doing this for me and thanks for the solution!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.