<div dir="ltr"><div>FYI:</div><div><br></div>Serializing a struct to json works without having to specify struct tags:<div><br></div><div>type foo struct {</div><div>    Name string</div><div>    Age int</div><div>}</div><div><br></div><div>f := foo{ "Bob", 40 }</div><div><br></div><div>serializes ("marshals") into</div><div><br></div><div>{</div><div>    "Name" : "Bob",</div><div>    "Age" : 40</div><div>}</div><div><br></div><div>No struct tags needed.  The only time you need struct tags is if you want to change the json name of one of the fields from being the same as the field name.  This is most commonly done to lowercase the field names when interoperating with an existing json service.  Note that only exported fields can be marshaled/unmarshaled, which is why you often see stuff like this:</div><div><br></div><div><div>type foo struct {</div><div>    Name string `json:"name"`</div><div>    Age int `json:"age"`</div><div>}</div></div><div><br></div><div>This lets the json package translate from the lowercase json name to the uppercase field name (and vice versa).  But when we control both ends of serialization (like in the api params package), we don't need to lowercase anything (in which case we can leave out the struct tags entirely).</div><div><br></div><div>Struct tags that are the same as the name of field are never needed:</div><div><br></div><div><div>type SomeResult struct {</div><div><span class="" style="white-space:pre">       </span>Error *Error                    `json:"Error"`</div><div><span class="" style="white-space:pre"> </span>Somethings []Something `json:"Somethings"`</div><div>}</div></div><div><br></div><div>The above is totally unnecessary... those fields will already serialize into "Error" and "Somethings".  There's a bunch of this in the apiserver/params package... you don't need it, so don't do it.   It just causes confusion, because it looks like you're changing the name from the default, even though you're not.</div><div><br></div><div>-Nate</div></div>