Javascript 标准化JSON数据
这是一篇文章的JSONJavascript 标准化JSON数据,javascript,json,redux,Javascript,Json,Redux,这是一篇文章的JSON { "id": "123", "author": { "id": "1", "name": "Paul" }, "title": "My awesome blog post", "comments": [ { "id": "324", "commenter": { "id": "2", "name": "Nicole" } } ] } 我目前正在浏
{
"id": "123",
"author": {
"id": "1",
"name": "Paul"
},
"title": "My awesome blog post",
"comments": [
{
"id": "324",
"commenter": {
"id": "2",
"name": "Nicole"
}
}
]
}
我目前正在浏览redux教程,他们提供了一个帮助器,可以规范JSON数据,有人知道这是什么类型的规范化吗?什么?还有10个…我不理解你的评论。你可以构建自定义的
json
文件,并在结果消息中设置key/value。
{
result: "123",
entities: {
"articles": {
"123": {
id: "123",
author: "1",
title: "My awesome blog post",
comments: [ "324" ]
}
},
"users": {
"1": { "id": "1", "name": "Paul" },
"2": { "id": "2", "name": "Nicole" }
},
"comments": {
"324": { id: "324", "commenter": "2" }
}
}
}