jolt

Re-parent a JSON object using Jolt

扶醉桌前 提交于 2019-12-02 09:17:25
I'd like to move a JSON object down one level using Jolt. Here's my input data : { "rating": { "primary": { "value": 3, "max": 5 }, "quality": { "value": 3, "max": 7 } } } I'm using the following spec file : [ { "operation": "shift", "spec": { "$": "NEWPARENT" } } ] I'm currently producing this output : { "NEWPARENT" : "root" } However, my goal is to produce : { "NEWPARENT": { "rating": { "primary": { "value": 3, "max": 5 }, "quality": { "value": 3, "max": 7 } } } } Can anyone help me create the proper spec file? Spec [ { "operation": "shift", "spec": { "@": "NEWPARENT" } } ] FYI, the "root"