在json输出中转义\ n \ t \ tt

时间:2016-11-09 09:38:39

标签: json

如何从json代码

下面删除新的\ n \ t \ tt
{"total_target":"100","campaign_details":" \n\t\t<p><u><h4>Basic Information<\/h4><\/u><\/p>\n\t\t<p><b>Campaign Name<\/b>  :   1034 SAP HANA<\/p>\n\t\t<p><b>Client Code<\/b>  :   1034<\/p>\n\t\t<p><b>Campaign Type<\/b>  :   Whitepaper<\/p>\n\t\t<p><b>Account Manager<\/b>  :   Super Admin<\/p>\n\t\t<p><b>Campaign Mode <\/b>  :   Email<\/p>\n\t\t<hr>\n\t\t\n\t\t<p><u><h4>Geographical Location<\/h4><\/u><\/p>\n\t\t<p><b>Country<\/b>  :   India,Canada<\/p>\n\t\t<p><b>State<\/b>  :   delhi,MAHARASHTRA<\/p>\n\t\t<p><b>City <\/b>  :   <\/p>\n\t\t<hr>\n\t\t<p><u><h4>Job Specification<\/h4><\/u><\/p>\n\t\t<p><b>Job Title<\/b>  :   IT Manager, VP, MD<\/p>\n\t\t<p><b>Job Level<\/b>  :   V-Level,C-Level<\/p>\n\t\t<p><b>Job Function <\/b>  :   <\/p>\n\t   "}
        get_lead:1019   {"total_target":"100","campaign_details":" \n\t\t<p><u><h4>Basic Information<\/h4><\/u><\/p>\n\t\t<p><b>Campaign Name<\/b>  :   1034 SAP HANA<\/p>\n\t\t<p><b>Client Code<\/b>  :   1034<\/p>\n\t\t<p><b>Campaign Type<\/b>  :   Whitepaper<\/p>\n\t\t<p><b>Account Manager<\/b>  :   Super Admin<\/p>\n\t\t<p><b>Campaign Mode <\/b>  :   Email<\/p>\n\t\t<hr>\n\t\t\n\t\t<p><u><h4>Geographical Location<\/h4><\/u><\/p>\n\t\t<p><b>Country<\/b>  :   India,Canada<\/p>\n\t\t<p><b>State<\/b>  :   delhi,MAHARASHTRA<\/p>\n\t\t<p><b>City <\/b>  :   <\/p>\n\t\t<hr>\n\t\t<p><u><h4>Job Specification<\/h4><\/u><\/p>\n\t\t<p><b>Job Title<\/b>  :   IT Manager, VP, MD<\/p>\n\t\t<p><b>Job Level<\/b>  :   V-Level,C-Level<\/p>\n\t\t<p><b>Job Function <\/b>  :   <\/p>\n\t   "}

1 个答案:

答案 0 :(得分:0)

像这样(在JavaScript中):

var filteredJsonString = stringWithJson.replace(/\n|\t/g, '')