我试图使用一个API,使用以下示例结构为他们返回的json
[
{
"customer":{
"first_name":"Test",
"last_name":"Account",
"email":"test1@example.com",
"organization":"",
"reference":null,
"id":3545134,
"created_at":"2013-08-06T15:51:15-04:00",
"updated_at":"2013-08-06T15:51:15-04:00",
"address":"",
"address_2":"",
"city":"",
"state":"",
"zip":"",
"country":"",
"phone":""
}
},
{
"customer":{
"first_name":"Test",
"last_name":"Account2",
"email":"test2@example.com",
"organization":"",
"reference":null,
"id":3570462,
"created_at":"2013-08-12T11:54:58-04:00",
"updated_at":"2013-08-12T11:54:58-04:00",
"address":"",
"address_2":"",
"city":"",
"state":"",
"zip":"",
"country":"",
"phone":""
}
}
]
Run Code Online (Sandbox Code Playgroud)
JSON.net可以使用类似以下结构的东西
{
"customer": {
["field1" : "value", etc...],
["field1" : "value", etc...],
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何让它对提供的结构感到满意.
使用默认的JsonConvert.DeserializeObject(content)会生成正确的Customer数,但所有数据都为null.
在CustomerList(下面)执行某些操作会导致"无法反序列化当前JSON数组"异常
public class CustomerList
{
public List<Customer> customer { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
思考?
尝试使用命令安装angular cli时
sudo npm install -g @angular/cli
Run Code Online (Sandbox Code Playgroud)
它似乎赶上了一个错误循环与下面的消息
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring …
Run Code Online (Sandbox Code Playgroud)