我想获取 FILE-file-id , FILE-fileSize FILENAME-id , INCIDENT-reportedOn 以下JObject中的strong>:
请注意开头的两个“ [[””。我必须先减少 _________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
block1_conv1 (Conv2D) (None, 224, 224, 64) 1792
_________________________________________________________________
block1_conv2 (Conv2D) (None, 224, 224, 64) 36928
**THE HIDDEN LAYERS**
_________________________________________________________________
fc1 (Dense) (None, 4096) 102764544
_________________________________________________________________
fc2 (Dense) (None, 4096) 16781312
_________________________________________________________________
predictions (Dense) (None, 1000) 4097000
_________________________________________________________________
dense_10 (Dense) (None, 2) 2002
=================================================================
Total params: 138,359,546
Trainable params: 2,002
Non-trainable params: 138,357,544
吗?
JObject
答案 0 :(得分:0)
我假设您已经从两个数组中提取了JObject
。在这种情况下,您可以像这样简单地使用索引运算符遍历json文件:
json["FILE"]["id"].Value<string>();
json["FILE"]["properties"]["fileSize"]["value"].Value<string>();
json["FILENAME"]["id"].Value<string>();
json["INCIDENT"]["properties"]["reportedOn"]["Value"].Value<string>();
完整示例:
const string text = @"{
"FILENAME": {
"id": "renamedtopdf.docx.pdf",
"label": "fileName",
"type": "vertex"
},
"FILE": {
"id": "dc92d48b7e29c528b3eb168446e51736101122a821c9e712320bd6842116719a",
"label": "file",
"type": "vertex",
"properties": {
"fileSize": [
{
"id": "f9339436-189a-4503-abc6-e2989be6f138",
"value": "164198"
}
],
"mimeType": [
{
"id": "0a89dbfa-c204-45c8-8524-3fbd02b04e39",
"value": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
}
]
}
},
"INCIDENT": {
"id": "16ea8c8b-65ee-44b3-afbb-98308b092b4f",
"label": "incident",
"type": "vertex",
"properties": {
"reportedOn": [
{
"id": "81485296-a62f-4d17-a03f-4995c3cad937",
"value": "2/16/2019 10:33:59 AM"
}
]
}
}
}";
var json = JObject.Parse(text);
json["FILE"]["id"].Value<string>();
json["FILE"]["properties"]["fileSize"]["value"].Value<string>();
json["FILENAME"]["id"].Value<string>();
json["INCIDENT"]["properties"]["reportedOn"]["Value"].Value<string>();