簡體   English   中英

nodejs中的XML2JS轉換

[英]XML2JS conversion in nodejs

嗨,當我使用 xml2js 節點 js lib 時,我需要一個幫助。 I am able to convert the XML to JSON object however when I am iterating JSON element I can see the '$': as few of the key elements. 有沒有辦法可以消除 $ 鍵?

嘗試正則表達式替換 $ 鍵

或者

使用 JSON.parse() 替換 $。

您可以使用attrkey$鍵更改為其他。

或者您可以忽略它(不創建屬性節點),將ignoreAttrs設置為true

根據xml2js 的自述文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM