【问题标题】:how to write complex json format in nodejs如何在nodejs中编写复杂的json格式
【发布时间】:2018-10-09 18:29:33
【问题描述】:

我有一个 Json 结构,我想使用 Nodejs 作为请求参数来创建它。我这里写的是json格式。

{ 
  "accounts": [
    {
        "address": {
        "street_address": "string",
        "locality": "string",
        "region": "string",
        "country": "string",
        "postal_code": "string",
        "phone": "string"
      },
       "admin_user": {
        "email_address": "",
        "first_name": "test",
        "last_name": "team",
        "job_title": ""
      },
      "name": "testAccount",
      "plan_id": ",
      "website": "",
      "reseller_id": "",
      "customer_id": "",
      "paid_seats": ""
    }
  ]
}

你能帮帮我吗?

【问题讨论】:

  • 你想把json写入文件吗?
  • 你能说得更具体点吗?创建它是什么意思?你的意思是把它分配给一个变量吗?
  • 嗨,我想创建一个像上面这样的 json 结构......我已经成功创建了最后一天......:)

标签: node.js json


【解决方案1】:

这是正确的。您只错过了“plain_id”值中的双引号。

正确:

"name": "testAccount",
  "plan_id": "",
  "website": "",
  "reseller_id": "",
  "customer_id": "",
  "paid_seats": ""

【讨论】:

    猜你喜欢
    • 2016-05-26
    • 1970-01-01
    • 1970-01-01
    • 2017-07-13
    • 2017-04-08
    • 2016-02-17
    • 1970-01-01
    • 2011-08-07
    • 1970-01-01
    相关资源
    最近更新 更多