json-convert
![Travis]()
![Github All Releases]()
Convert json to json you want
How to use
install
``
npm install json-convert --save
`
convert json
`
var jsonConver = require('json-conver');
var dataFromAjax = {
title: 2,
article: {
time: 'xxx',
author: 'x'
}
};
var convertRule = {
'title': 'subTitle',
'article.time': 'time',
'article.author': 'author'
};
var result = jsonConvert(dataFromAjax, convertRule);
/*
* the json is converted to:
* {
* title: 2,
* time: 'xxx',
* author: 'x'
* }
*/
``
API
$3
- json