I can also confirm that structural indentation eventually causes problems in anything intended for transmission; problems that, e.g. JSON does not have.
Also, it's problematic to have multiple syntactic forms for the same thing, e.g. people are less inclined to implement a parser when
1, 2, 3
means the same thing as:
1
2
3
Further, just as you can't assume whitespace won't get removed, you can't assume whitespace, such as newlines, won't get added, such as when this data is copied into an email message, or anything else that enforces a maximum line length. I suspect that a parse would fail when some part of the transmission transforms the first example into:
1, 2,
3
The explicit structure of JSON, for example, is both syntactically simpler and more resistant to these issues. If you want it all on one line, it's:
[1, 2, 3]
and on multiple lines:
[ 1
, 2
, 3
]
Visually, it's unambiguous that you're dealing with a JSON array, and since whitespace is unimportant between JSON tokens, the above two examples can be treated as being syntactically and semantically identical.
As per points mentioned earlier in this thread, GSON is clearly a reference to JSON, and JSON is valid JavaScript; because of this, I'd recommend against calling it GSON unless it is valid Go, or a substantial syntactic overlap with Go.
How important is the ability to specify cyclic structures truly? Even in typical Go code, cycles are fairly rare. If you need such references, one option is to go the
JSON Pointer or XPath route. For example:
{ x: / }
(slash in this example meaning 'whole document') could represent a document in which the struct contains a reference to itself, such that if it were expanded once and then serialized, it would look like:
{ x: { x: /x } }
and if expanded twice and serialized, would look like:
{ x: { x: { x: /x/x } } }
Closing note: if you're looking for a indent-structured data format with cyclic capabilities and the ability to specify explicit, user-defined type type annotations, then YAML already has all those features.