Hacker News new | ask | show | jobs
by karavelov 1974 days ago
Naming fields is a small pain, the PITA is that JSON does not have native encoding for enum/variant/sum types. So now there are multiple ways to encode them: internally tagged, externally tagged, adjacently tagged, implicit/untagged. And JSON schema does not solve that at all: you can write schemas for all of them, but they do not convey the same information in the end languages even if they have all the type capabilities.
1 comments

Enum and variant/sum types are supported by a lot of serialization frameworks that have JSON serializations though. Thrift, Avro, Protocol Buffers, Flatbuffers etc.

JSON is not a framework for serialization anymore than XML is.