【发布时间】:2016-07-05 02:13:21
【问题描述】:
我有以下从 API 获取并保存在 C# 中的对象中的 JSON 数据,并希望它插入 SQL 数据库中。
{
"6389": {
"Offer": {
"id": "6389",
"name": "Swim",
"description": "Incent",
"require_approval": "1",
}
},
"6141": {
"Offer": {
"id": "6141",
"name": "Express",
"description": "Incent",
"require_approval": "1",
}
},
"5677": {
"Offer": {
"id": "5677",
"name": "Alive",
"description": "",
"require_approval": "1",
}
},
"6669": {
"Offer": {
"id": "6669",
"name": "All",
"description": "Incent\r\",
"require_approval": "1",
}
},
"6767": {
"Offer": {
"id": "6767",
"name": "App",
"description": "",
"require_approval": "1",
}
}
}
我想将上面的 JSON 保存为以下格式的 SQL 数据库表。
ID name description require_approval
6389 Swim Incent 1
6141 Express Incent 1
5677 Alive 1
6669 All Incent/r/ 1
6767 App 1
提前致谢。
【问题讨论】:
-
假设数据中的任何差异只是为了方便,您在将数据插入数据库时遇到什么问题?
-
JSON 和 table 之间的数据不匹配是错误的。你知道我应该怎么做才能在 SQL 表中插入以下 JSON 吗?
-
我是 C# 编码的新手,我不知道如何使用它们。如果您知道,您能否提供代码或任何参考链接?谢谢。
-
@Sindhu:你两次提出同样的问题吗? stackoverflow.com/questions/36061520/…