https://github.com/binocarlos/json-fields
JSON.parse and JSON.stringify for certain properties of an object
https://github.com/binocarlos/json-fields
Last synced: 10 months ago
JSON representation
JSON.parse and JSON.stringify for certain properties of an object
- Host: GitHub
- URL: https://github.com/binocarlos/json-fields
- Owner: binocarlos
- Created: 2013-12-13T16:05:32.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-13T16:07:17.000Z (about 12 years ago)
- Last Synced: 2025-02-05T05:34:58.522Z (11 months ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
json-fields
===========

JSON.parse and JSON.stringify for certain properties of an object
# install
```
$ npm install json-fields
```
## example
JSON.parse some fields of an object:
```js
var jsonfields = require('json-fields');
var obj = {
'x-json-user':'{"name":"bob"}',
'x-json-thing':'{"apple":"green"}',
'normalfield':'{"a":10}'
}
var parsedobj = jsonfields.parse(obj, 'x-json');
```
JSON.stringify some fields of an object:
```js
var jsonfields = require('json-fields');
var obj = {
'x-json-user':{
name:'bob'
},
'x-json-thing':{
apple:'green'
},
'normalfield':'{"a":10}'
}
var stringobj = jsonfields.stringify(obj, 'x-json');
```
## licence
MIT