Re:Browsers, JSON, and FormData
by Kinrany on Saturday November 12, 2022 @06:36AM
(#33572153)
JSON is close to using the most fundamental logical primitives needed to structure serialized data. It's a set of value types, an ordered collection and a key-value collection.
[ Parent
| on HN ]
With a syntax that's ridiculously easy to write a parser and generator for (with the one exception of high unicode character escape sequences being encoded as two \uXXXX escapes after each other which form a surrogate pair rather than one \uXXXXXXXX escape, which is a bitch to deal with unless you use UTF-16 internally). It's certainly easier to write a mostly-correct JSON parser than an XML parser.
Re:Browsers, JSON, and FormData
by artificialLimbs on Saturday November 12, 2022 @12:41PM
(#33575247)
But why not just return hypermedia, assuming a web page?
What do you mean? JSON can be hypermedia, you can even click hyperlinks in browsers.
Re:Browsers, JSON, and FormData
by artificialLimbs on Sunday November 13, 2022 @02:11PM
(#33586303)
You can't return JSON to the browser. (I mean you can, but why lol?)
You have to interpret both up and down stream with a JSON parser (usually JS). In contrast, you can return hypertext/hypermedia directly to the browser and the user can interact with it immediately, without needing translation layers.
A primer: https://dev.to/rajasegar/html-over-the-wire-is-the-future-of...