I have an example of json as below:
{"key1": "val1", "key2": "val2", "key3": [{"k1": v1"}, {"k2": "v2"}]}
Now I need to split it into two objects:
{"key1": "val1", "key2": "val2", "key3": {"k1": v1"}}
and
{"key1": "val1", "key2": "val2", "key3": {"k2": v2"}}
Basically I want to split the key3 elements keeping all other keys same in the new structure.
My structure is as below:
type myType struct {
key1 string
key2 string
key3 []interface{}
}
Please let me know how I can achieve that.
With regards, -M-