qntfy / kazaam

Arbitrary transformations of JSON in Golang
MIT License
282 stars 54 forks source link

Spec for array inside array #82

Open wyattleetech opened 6 years ago

wyattleetech commented 6 years ago

Hi, I am straggling to define a spec to transform a json with an array inside an array. Here is the original json: { "contents": [ { "id": 1, "name": "aaa1", "members": [ { "member_id": 11, "member_name": "bbb1" }, { "member_id": 12, "member_name": "ccc1" } ] }, { "id": 2, "name": "aaa2", "members": [ { "member_id": 21, "member_name": "bbb2" }, { "member_id": 22, "member_name": "ccc2" } ] }
], "meta": { "meta1": "mmm1", "meta2": "mmm2" } }

And here is the expected json: { "contents": [ { "c_id": 1, "c_name": "aaa1", "members": [ { "mem_id": 11, "mem_name": "bbb1" }, { "mem_id": 12, "mem_name": "ccc1" } ] }, { "c_id": 2, "c_name": "aaa2", "members": [ { "mem_id": 21, "mem_name": "bbb2" }, { "mem_id": 22, "mem_name": "ccc2" } ] }
], "meta": { "c_meta1": "mmm1", "c_meta2": "mmm2" } }

Can any one help me with the spec? Thanks!

henry-megarry commented 5 years ago

@wyattleetech I have a similar situation did you ever figure out how to do this?