I have a generated JSON file that I would like to transform. Is there an easy way to transform the "id"/"value" form of this JSON to a proper key/value JSON object, without using any frameworks?
These lines: "value":"chrome", "id":"foo" would convert to: "foo": "chrome"
Input JSON:
{"row":[ { "column":[ { "value":"chrome", "id":"foo" }, { "value":0, "id":"bar" }, { "value":"baz1", "id":"baz" }, { "value":0, "id":"legacy" } ] }, { "column":[ { "value":"firefox", "id":"foo" }, { "value":0, "id":"bar" }, { "value":"baz2", "id":"baz" }, { "value":0, "id":"legacy" } ] } ] }
Desired JSON:
{"row":[ { "foo":"chrome", "bar":0, "baz":"baz1", "legacy":0 }, { "foo":"firefox", "bar":0, "baz":"baz2", "legacy":0 } ] }