How to convert JSON array to CSV using Node.js?

前端 未结 4 1451
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 13:49

I want to convert json which has value array. response.json

{
\"rows\": [
[
  \"New Visitor\",
  \"(not set)\",
  \"(not set)\",      
  \"0\"
]         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-05 14:03

    I would like to share the easiest way to build a csv string from a json array:

    const data = [
      { a: 1, b: new Date(), c: 'a text' },
      {
        a: 1, b: new Date(), c: `string
      with
      return
      carrier
      and emoji 

提交回复
热议问题