How would I unmarshal something like this:
[
2,
"19223201",
"SomeString",
{
"SomeField": "FieldValue",
"SomeField2": "FieldValue2", "SomeFieldN": "FieldValueN", }
]
How would I unmarshal something like this:
[
2,
"19223201",
"SomeString",
{
"SomeField": "FieldValue",
"SomeField2": "FieldValue2", "SomeFieldN": "FieldValueN", }
]
You can use interface{}
if you have not define any interface and unmarshal into interface type slice.
import (
"fmt"
"encoding/json"
)
func main() {
strBytes := []byte(`[2,"19223201", "SomeString",{"SomeField": "FieldValue","SomeField2": "FieldValue2", "SomeFieldN": "FieldValueN"}]`)
keys := make([]interface{},0)
json.Unmarshal(strBytes, &keys)
fmt.Println(keys)
}