nvp-json
Version:
A bidirectional NVP/JSON parser for use with PayPal NVP APIs.
44 lines (27 loc) • 1.59 kB
Markdown
# nvp-json
[](https://www.npmjs.com/package/nvp-json) [](https://travis-ci.org/carriejv/nvp-json-js) [](https://www.npmjs.com/package/nvp-json) [](https://www.codacy.com/app/carriejv/nvp-json-js?utm_source=github.com&utm_medium=referral&utm_content=carriejv/nvp-json-js&utm_campaign=Badge_Coverage)
[](https://david-dm.org/carriejv/nvp-json-js) [](https://github.com/carriejv/nvp-json-js/actions?query=workflow%3Aci-build) [](https://www.gitkraken.com/invite/om4Du5zG)
A bi-directional NVP-JSON parser, for use with [PayPal's NVP APIs](https://developer.paypal.com/reference/?mark=endpoints).
Tested with Node >= 6 LTS.
## Installation
`npm install nvp-json`
or
`yarn add nvp-json`
## Usage
```javascript
const nvpjson = require('nvp-json');
let nvpString = 'KEY=VALUE&ESCAPED[5]=& [1]=';
let json = nvpjson.toJSON(nvpString);
/*
* {KEY: 'VALUE', ESCAPED: '& [1]='}
*/
let nvp = nvpjson.toNVP({
KEY: 'VALUE',
ESCAPED: '& [1]='
});
/*
* KEY=VALUE&ESCAPED[5]=& [1]=
*/
```
## License
[MIT](https://github.com/carriejv/nvp-json/blob/master/LICENSE)