jquery-serialize-object icon indicating copy to clipboard operation
jquery-serialize-object copied to clipboard

How to convert Complex forms ?

Open wangfan0840 opened this issue 7 years ago • 1 comments
trafficstars

hi!

<input name="user[email]" value="[email protected]">
 <input name="user[pets][]" type="checkbox" value="cat" checked>
 <input name="user[pets][][cat][]" type="checkbox" value="cat1" checked>
 <input name="user[pets][][cat][]" type="checkbox" value="cat2" checked>
 <input name="user[pets][]" type="checkbox" value="dog" checked>
 <input name="user[pets][]" type="checkbox" value="bird">

i want to got a json like: {user: {email: "[email protected]", pets: [cat:["cat1","cat2"], "dog"]}} but l got a json : { "user":{"email":"[email protected]","pets":["cat", "dog",null,{"cat":[null,null,"cat2"]} ]} please tell me how to get the correct json string ! thanks!

wangfan0840 avatar Feb 07 '18 07:02 wangfan0840

This is not valid

[cat:["cat1","cat2"], "dog"]

macek avatar Mar 01 '18 02:03 macek