如何通过 JavaScript 将 XML(SOAP) 转换为 JSON 对象
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6825321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to convert XML(SOAP) to JSON object by JavaScript
提问by GauravSTomar
is this possible to send cross site request by AJAX with a SOAP request and get XML response? and i want to convert my xml response to json format is there any framework (like mustache) to do this easily
这是否可以通过带有 SOAP 请求的 AJAX 发送跨站点请求并获得 XML 响应?我想将我的 xml 响应转换为 json 格式是否有任何框架(如 mustache)可以轻松完成此操作
采纳答案by sach
You can make use of xml2js node library. It converts xml to json and vice versa. But it doesn't uses templates. https://www.npmjs.com/package/xml2js
您可以使用 xml2js 节点库。它将 xml 转换为 json,反之亦然。但它不使用模板。https://www.npmjs.com/package/xml2js