1.0.2 • Published 5 years ago
json-stringify-format v1.0.2
json-stringify-format
Used to format JSON strings
Feature
- Format the JSON string
Browser Support
targets: {
"edge": "17",
"firefox": "60",
"safari": "11.1",
"chrome": "58",
"ie": "11"
}
Installing
Using npm:
$ npm install json-stringify-format
Using yarn:
$ yarn add json-stringify-format
Example
import jsonFormat from 'json-stringify-format'
const originData = '{"inline":false,"defaultValue":0,"showLabel":false,"options":[{"value":0,"label":"\u5de6"},{"value":1,"label":"\u53f3"}],"required":false,"width":"","remote":false,"remoteOptions":[],"props":{"value":"value","label":"label"},"remoteFunc":""}'
processedData = jsonFormat(originData)
console.log(processedData)
{
"inline": false,
"defaultValue": 0,
"showLabel": false,
"options": [
{
"value": 0,
"label": "左"
},
{
"value": 1,
"label": "右"
}
],
"required": false,
"width": "",
"remote": false,
"remoteOptions": [
],
"props": {
"value": "value",
"label": "label"
},
"remoteFunc": ""
}