Skip to content

FoooooooF/querystring2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

querystring to json

querystring to json & json to querystring

use in script

  • import index.js
  • index.js export global qs object with two methods parse and stringify
    <script src="./lib/index.js"></script>
  • example
    //parse
    let str="a=1&a=2&b=2&c=3&d=123&e=true"
    let obj=qs.parse(str); //{ a: [ '1', '2' ], b: '2', c: '3',d:123,e:true }

    //stringify
    let obj={ a: [ '1', '2' ], b: '2', c: '3',d:123,e:true };
    let str=qs.stringify(obj); //"a=1&a=2&b=2&c=3&d=123&e=true"

use in node

  • install
    npm i querystring2json
  • example
    const qs =require("querystring2json");
    let str="a=1&a=2&b=2&c=3&d=123&e=true";
    let obj=qs.parse(str);
    console.log(obj); //{ a: [ '1', '2' ], b: '2', c: '3',d:123,e:true }
    console.log(qs.stringify(obj)); //"a=1&a=2&b=2&c=3&d=123&e=true"

to develop

  • install
    npm install
  • test
    npm run test
  • build
    npm run build

About

querystring to json & json to querystring

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published