query-to-json-es6

query strings to json

Usage no npm install needed!

<script type="module">
  import queryToJsonEs6 from 'https://cdn.skypack.dev/query-to-json-es6';
</script>

README

query-string Build Status

Install

$ npm i --save query-to-json

Usage

Query to JSON
var query = require( "query-to-json" );
var parsedQuery = query.queryToJson("?param1=foo&param2=bar");
//=> {
  param1: "foo",
  param2: "bar"
}
JSON to Query
var query = require( "query-to-json" );
var object1 = {
   param1: "foo",
   param2: "bar"
};
var parsedQuery = jsonToQuery(object1);

//=> "?param1=foo&param2=bar"