How should the @lang field be saved using JSON (with the Go package)?

Using mutation in JSON you can simply use <"predicate + @ + Lang">

e.g in JSON format:

{
    "set": [
        {
            "name@en": "english",
            "name@ru": "Russian",
            "TEST": "X"
        },
        {
            "name": "Amit",
            "name@ru": "Russian"
        }
    ]
}

I’m not sure about this below, I’m using JSON-to-Go: Convert JSON to Go instantly

type AutoGenerated struct {
	NameEn string `json:"name@en"`
	NameRu string `json:"name@ru"`
	TEST   string `json:"TEST"`
}

# whole array
type AutoGenerated []struct {
	NameEn string `json:"name@en,omitempty"`
	NameRu string `json:"name@ru"`
	TEST   string `json:"TEST,omitempty"`
	Name   string `json:"name,omitempty"`
}
1 Like