3 ms·
Are you sure you want hierarchy though? [ ["the ", {}], ["JSON format", {"link": "https://www.json.org/"}], ["was invented by ", {}], ["Dougl
by jpochtar 7y ago
Are you sure you want hierarchy though?
[
["the ", {}],
["JSON format", {"link": "https://www.json.org/"}],
["was invented by ", {}],
["Douglas Crockford", {"bold": true}],
[".", {}]
]
- pig-disgusting 7y agoA. You forgot to capitalize the first word in the sentence. B. Your dangling whitespace characters are all wrong. This tells me that the steps you took to craft the serialized version of the data were totally disconnected from the intent of the transmission. You were more focused on syntax (decorative array brackets, and curly brace closures), than the human-readable aspects of the text. More often than not, this is expressed as unclosed tags in XML mark up, which would express as run-on underlined link activation and bold face. Yet this is often cleaner, when formatting gets stripped out, preserving whitespace delimiters such that text us ungarbled. In the source, this sometimes leads to excessive whitespace bloat, but luxuriously so.
- contravariant 7y agoIn this particular example you need hierarchy for on at least two occasions. 1. The xml denotes that the whole thing should be wrapped in a div, and shouldn't just be considered a paragraph. With only lists you can't denote what kind of level you're at, unless you force each level to always carry the same meaning (which makes the format weaker than XML). 2. Setting "bold" to true isn't the same thing as emphasizing the text. Typically 'em' is italic, but more importantly a nested 'em' should no longer be italic. To achieve this with JSON you're forced to combine formatting and structure in a way that CSS was designed to prevent.