Skip to content

luhw/formatAsHttpBuildQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

formatParams.js

序列化一个key/value对

实例

    var myObject = {
      a: {
        one: 1, 
        two: 2, 
        three: [1, 2]
      }, 
      b: [1, 2, 3]
    };
var str = formatParams(myObject);
结果:
    {
      a[one]: 1,
      a[two]: 2,
      a[three][0]: 1,
      a[three][1]: 2
      b[0]: 1,
      b[1]: 2,
      b[2]: 3
    }
  
最后将结果自由拼接即可

About

format as formData

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published