![](/img/trans.png)
[英]How to convert json string to array of custom object in json2typescript NPM node module in TypeScript
[英]How to convert JSON data array object to custom string?
當前結果:
master data :`[object Object]`
with stringify:
[{"bundlingId":"10547","countqtybuy":1},
{"bundlingId":"19386","countqtybuy":2}]
with toString: `[object Object]`
with toString + stringify:
[{"bundlingId":"10547","countqtybuy":1},
{"bundlingId":"19386","countqtybuy":2}]
我的預期結果:
10547,1;19386,2
因為我看到你在錯誤的軌道上,所以我為你發布了這個
const obj = JSON.parse`[{"bundlingId":"10547","countqtybuy":1}, {"bundlingId":"19386","countqtybuy":2}]` const values = obj.map(item => Object.values(item).join(",")).join(";") console.log(values)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.