Parsing a JSON payload without a top-level keyword

A list on its own is valid JSON, and using a slice as the output type is correct, you don’t need to wrap this in a struct.

UnexpectedToken usually means that the type of the field doesn’t match what it found in the JSON. For example, a string instead of a boolean value (eg, “true”), or null for a field that’s not defined as an optional

1 Like