我有一个index.js文件,该文件使用以下代码返回Eloqua REST obj的主体:
我尝试使用JSON.stringify
和这个prettyJOSNStringify
var request = require('request');
var prettyJSONStringify = require('pretty-json-stringify');
request(
{
url : "https://secure.p03.eloqua.com/api/rest/2.0/assets/form/XXX",
headers : { "Authorization" : authenticationHeader }
},
function (error, response, body) {
console.log(prettyJSONStringify(body));
}
);
但是控制台中的响应只是一个巨大的JSON,如何清理呢?
{\“ type \”:\“ Form \”,\“ currentStatus \”:\“ Draft \”,\“ id \”:\“ 912 \”,\“ createdAt \”:\“ 1544810248 \ “,\” createdBy \“:\” 35 \“,\” depth \“:\” complete \“,\” folderId \“:\” 5487 \“,\” name \“:\” Let's Connect Web Form 3.0-垂直\“,\”权限\“:[\”检索\“,\”删除\“,\”更新\“],\” updatedAt \“:\” 1545074293 \“,\” updatedBy \“: \“ 35 \”,\“ customCSS \”:\“ \ / * RESET * \ /。elq-form * {边距:0;填充:0;}。elq-form输入,textarea {\ u0009-webkit-box -sizing:content-box; \ u0009-moz-box-sizing:content-box; \ u0009box-sizing:content-box;}。elq-form input [type = text] ,. elq-form textarea,.elq-形式select [multiple = multiple] {\ u0009border:1px solid#A6A6A6;} .elq-form按钮,输入[type = reset],输入[type = button],输入[type = submit],输入[type = checkbox] ,输入[type = radio],选择{\ u0009-webkit-box-sizing:border-box; \ u0009-moz-box-sizing:border-box; \ u0009box-sizing:border-box;} \ / * GENERIC * \ /。elq形式的输入{\