[w3c/manifest] Type errors surrounding JSON "types" (#984)

The manifest spec claims to rely on [JSON](https://www.w3.org/TR/appmanifest/#bib-json) specification types for object, array, string, and boolean. The linked specification (and any others I can find) only defines how those types are represented in a JSON string, not how they might be treated as data structures (eg. json["key"] is not defined). JSON is a _syntax only_ - a JSON object is just a string that begins with "{" and ends with "}". Yet these are manipulated throughout the spec as if they were JavaScript objects.

I think there are two options to correct this:
1. Refer to the [infra](https://infra.spec.whatwg.org/) definitions of map, list, string, and boolean (respectively) instead. Make the `parse json from bytes` step in [processing a manifest](https://www.w3.org/TR/appmanifest/#dfn-processing-a-manifest) refer to [parse JSON bytes to an infra value](https://infra.spec.whatwg.org/#parse-json-bytes-to-an-infra-value) instead. Aside: we may need to clarify what `the type of map[key]` is when `map[key]` does not exist, as this is used frequently and would be an assertion failure in an infra map.
2. Refer to the [JavaScript definitions](https://tc39.es/ecma262/#sec-object-type) of object, array, string, and boolean. This is actually already the type we have linked from the [parse json from bytes](https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value) step in [processing a manifest](https://www.w3.org/TR/appmanifest/#dfn-processing-a-manifest)

I think option 1 is better, as it puts less cognitive load on the reader, only having to consider manipulating infra types, vs both infra and (more complex) JS data types.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/984

Received on Friday, 11 June 2021 04:00:18 UTC