jsonify-url-payload
v0.1.1
Published
Add or parse some json stringified payload to url.
Downloads
9
Readme
jsonify-url-payload
Introduction
Mix jsonify payload to URL.
Parse jsonify payload from URL.
Install
Node:
npm i -D jsonify-url-payload
Browser:
<script src="./dist/jsonify-url-payload.umd.min.js"></script>
Usage
Import in Node(es):
import { mixer, parser } from 'jsonify-url-payload'
Import in Browser:
const { mixer, parser } = jsonifyURL
Then
const myURL = mixer('127.0.0.1', { a: 1, b: '2', c: [3], d: { e: '你好' } })
// => 127.0.0.1?a=1&b=%222%22&c=%5B3%5D&d=%7B%22e%22%3A%22%E4%BD%A0%E5%A5%BD%22%7D
const myPayload = parser(myURL)
// => { a: 1, b: '2', c: [3], d: { e: '你好' } }
See also test cases.