HTML JSON form submission

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.

Christophe

-- 
On Clojure http://clj-me.cgrand.net/
Clojure Programming http://clojurebook.com
Training, Consulting & Contracting http://lambdanext.eu/

Received on Friday, 28 November 2014 10:50:36 UTC