News for hackers. Stuff that matters.
Re:Where is Ruby Headed in 2021? by lifthrasiir on Friday November 19, 2021 @11:20AM (#29278805)
> I don't do that anymore. When programin in Go, JSON is just a serialization format for a struct. You have a concrete struct type and you just use json to fill it with data. It's so easy and trivial.

This does mean that you should know and define your schema in advance, which is not always doable. An alternative is to use a sum type and pattern to safely deconstruct `interface{}` but Go has a notably poor support for sum types. Static typing is not really a culprit here, but Go would make a bad example for anonymous JSON parsing.

There are no comments on this comment yet.