支持将一个HTML表单序列化成JavaScript对象,支持嵌套属性和数组。Usage Example
HTML form (input, textarea and select tags supported):
<form> <!-- simple attribute --> <input type="text" value="Mario Izquierdo" /> <!-- nested attributes --> <input type="text" value="San Francisco" /> <input type="text" value="California" /> <input type="text" value="CA" /> <!-- array --> <input type="text" value="code" /> <input type="text" value="climbing" /> <!-- and more ... --> <textarea>serializeJSON</textarea> <textarea>javascript</textarea> <input type="hidden" value="0" /> <input type="checkbox" value="1" checked="checked"/> <textarea>tinytest.js</textarea> <textarea>javascript</textarea> <input type="hidden" value="0" /> <input type="checkbox" value="1"/> </form>JavaScript:
$('#my-profile').serializeJSON(); // returns => { fullName: "Mario Izquierdo", address: { city: "San Francisco", state: { name: "California", abbr: "CA" } }, jobbies: ["code", "climbing"], projects: { '0': { name: "serializeJSON", language: "javascript", popular: "1" }, '1': { name: "tinytest.js", language: "javascript", popular: "0" } } }项目主页:
扩展阅读让 SpringMVC 接收多个对象的4种方法Jquery 将表单序列化为Json对象
将表单转成JSON提交:jquery html json forms
疯狂Html+CSS+JS 中JS总结
为您推荐React, Redux and Immutable.js: Ingredients for Efficient Web Applications
Go语言(golang)开源项目大全
程序员瑞典最大的约会网站的开发测试经验
netty处理客户端传过来的get、post、websocket数据例子
非常棒的Go语言框架,库和软件集合:Awesome Go
更多jquery.serializeJSON
表单相关jQuery插件