0
我需要將一些JSON數據發佈到webAPI並將其保存到數據庫,現在我從未使用過webAPI,因此我在這裏完成了一個學習曲線。將JSON發佈到WebAPI
到目前爲止,我已經創建了一個的WebAPI項目,並和數據庫表容納在SQL中的數據,我已經通過實體框架添加的模型
我創建了一個叫做的FormController
的API控制器,這是即將發佈
{
"msg": {
"params": {},
"payload": {},
"files": {
"74277A30-5740-4102-A183-697382A4C240.json": {
"mimeType": "application/json",
"data": {
"auto": [],
"form": {
"formId": "74277A30-5740-4102-A183-697382A4C240"
},
"fields": [
{
"@name": "Patient Name",
"@type": "DataTypeText",
"value": "Jane Doe"
},
{
"@name": "Date",
"@type": "DataTypeText",
"value": "2016-06-08T12:00:00Z"
},
{
"@name": "Hospital",
"@type": "DataTypeText",
"value": "Burwood Hospital"
},
{
"@name": "Wing",
"@type": "DataTypeText",
"value": "North Wing"
},
{
"@name": "Level",
"@type": "DataTypeText",
"value": "2"
},
{
"@name": "Bed",
"@type": "DataTypeNumber",
"value": "11"
},
{
"@name": "Severity",
"@type": "DataTypeList",
"value": [
"High"
]
},
{
"@name": "Validation",
"@type": "DataTypeList",
"value": [
"Checked Medical Chart",
"Personally spoken to patient",
"Patient is awake"
]
},
{
"@name": "Requested by",
"@type": "DataTypeText",
"value": "Nice nurse"
}
],
"template": {
"name": "Paul Demo App",
"templateId": "f9f0d5e2-84cb-a345-c1d1-f374c22a40fc",
"templateLink": ""
},
"version": "1.0"
},
"fieldName": "file",
"originalName": "74277A30-5740-4102-A183-697382A4C240.json",
"encoding": "7bit",
"size": 1725
}
}
},
"node": "302df9b0-2dec-11e6-816e-2f924acaff65"
}
我需要從「域」部分中獲取數據,然後將該保存到我的數據庫的JSON
道歉,如果我在這裏模糊,只是解僱我的意見,我會盡力回答你的問題
這是json。將其解碼爲本地結構,然後像訪問任何其他本地結構一樣訪問這些部分。 –