Skip to content

jaycetde/serialize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serialize

Serialize forms into JSON object

Installation

$ component install JayceTDE/serialize

Dependencies

API

<form id="form">
    <input type="text" name="username" value="USERNAME" />
    <input type="password" name="password" value="PASSWORD" />
    <input type="text" name="birth.month" value="JANUARY" />
    <input type="text" name="birth.year" value="1980" />
    <input type="hidden" name="multiple" value="a" />
    <input type="hidden" name="multiple" value="b" />
    <input type="hidden" name="multiple" value="c" />
    <input type="submit" />
</form>
var serialize = require('serialize')
  , form = document.querySelector('#form')
;

serialize(form);
/*
{
  username: "USERNAME",
  password: "PASSWORD",
  birth: {
    month: "JANUARY",
    year: "1980"
  },
  multiple: ['a', 'b', 'c']
}
*/

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published