- From: Robin Berjon <robin@w3.org>
- Date: Wed, 10 Dec 2014 17:47:34 +0100
- To: Larry Masinter <masinter@adobe.com>, "christophe@cgrand.net" <christophe@cgrand.net>, "public-html@w3.org" <public-html@w3.org>
On 02/12/2014 04:47 , Larry Masinter wrote:
> If you actually want to use JSON and not something “kind of like JSON
> but not quite”, then JSON (http://tools.ietf.org/html/rfc7159)
> name/value pairs are unordered.
I don't think that's the question at hand. The specification clearly
just uses JSON.
> *From:*christophe.grand@gmail.com [mailto:christophe.grand@gmail.com]
>
> It seems to me that the encoding algorithm
> http://www.w3.org/TR/html-json-forms/#the-application-json-encoding-algorithm
> depends on the ordering of inputs:
>
> <form enctype='application/json'>
> <input name='foo' value='one'>
> <input name='foo' value='two'>
> <input name='foo[x]' value='three'>
> </form>
>
> {"foo": {"1": one", "2": "two", "x": "three"}}
>
> <form enctype='application/json'>
> <input name='foo[x]' value='three'>
> <input name='foo' value='one'>
> <input name='foo' value='two'>
> </form>
>
> {"foo": {"": ["one", "two"], "x": "three"}
>
> Sorting inputs before encoding them would make the algorithm simpler and
> clearly independent of the actual ordering.
Unless I'm missing something, I don't think that you can define "actual
ordering" in a manner that is generally meaningful here. The encoding
does indeed depend on the tree order of the input elements, which is
already the case with existing encodings.
--
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Wednesday, 10 December 2014 16:47:40 UTC