Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 11 days 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 (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-13T16:07:17.000Z (almost 11 years ago)
- Last Synced: 2024-10-13T13:21:30.304Z (about 1 month 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
===========![Build status](https://api.travis-ci.org/binocarlos/json-fields.png)
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