Re: Submitting forms as JSON

On 26/02/2014 10:03 , Innovimax W3C wrote:
> Very nice ! Clear ! Well written !

Thanks :)

> How do you parse the following
>
> == With Double Quote ==
>
> <form  enctype='application/json'>
>    <input  name='fi"le'  value='file'>
> </form>

Yields:

{ "fi\"le": "file" }

> == With \n (or any other ) ==
>
> <form  enctype='application/json'>
>    <input  name='fi&#xA;le'  value='file'>
> </form>

{ "fi\nle": "file" }

> == Null value ==
>
> There is no defined way to add a null value

I know; I'm not sure it's needed though.

> == Tricky case ==
> <form  enctype='application/json'>
>    <input  name='wow[such]'  value='Amaze1'>
>    <input  name='wow[such]'  value='Amaze2'>
>    <input  name='wow[such][1]'  value='Amaze3'>
> </form>

That would yield:

{ "wow": { "such": ["Amaze1", ["Amaze2", "Amaze3"]] } }

Which opens up the question: is it a strict requirement to lose no 
information from the form? If we remove that requirement we can come up 
with a simpler algorithm, that ought to produce simpler data, but might 
not cause everything in the form to be captured.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Monday, 3 March 2014 16:04:38 UTC