1
我怎样才能在下列情况下,JSON对象:如何获得JSON休息响应 - Node.js的
这里是我的POST请求:data.toString的
var articles = client.post("http://host:port/path", args, function (data, response) {
// console.log(xml.parseBuffer(data))
console.log(data.toString('utf8'));
// return xml.parseBuffer(data);
});
结果( 'UTF-8' )看起来像:
<WebServiceResponse>
<page>
...
</page>
<articleDataList>
<articleId>
<idArticle>100000</idArticle>
<index>test</index>
</articleId>
<goodType>test</goodType>
<idAttributeSubject>100001</idAttributeSubject>
<identyfiable>false</identyfiable>
<isActive>true</isActive>
<isGoodSet>false</isGoodSet>
<longName>test</longName>
<translationSubjectId>
<idTranslationSubject>100408</idTranslationSubject>
</translationSubjectId>
<unitCode>szt</unitCode>
<vatRate>0.2300</vatRate>
</articleDataList>
<articleDataList>
...
</articleDataList>
<articleDataList>
...
和xml.parseBuffer(数据)外观: {名称:“articleD ataList',childs:[Object]},
我需要把文章对象只用:idArticle,index和shortName 有什么简单的方法吗?
不行,你能解释一下吗? – tyskocz