how can i get name property out of this json file. c#

  • Thread starter Thread starter elfenliedtopfan2
  • Start date Start date
E

elfenliedtopfan2

Guest
ok i been trying now for the last 3 hours to get the name prop out of this json i cut the json short because the file is huge


"/i/models/fc6d6067621442ebb6f4238636363d47": {
"staffpickedAt": null,
"files": [
{
"wireframeSize": 222696,
"flag": 0,
"osgjsUrl": "https://media.sketchfab.com/urls/fc...e8d179b751d4cecb42ac61a72a83f15/file.osgjs.gz",
"uid": "3e8d179b751d4cecb42ac61a72a83f15",
"osgjsSize": 69069,
"modelSize": 516884
}
],
"processingStatus": 2,
"isPublished": true,
"isPrivate": false,
"viewCount": 4547,
"averageRating": null,
"user": {
"uid": "4f14c4754d37418baeed49d9030992ef",
"displayName": "Tim Bergholz - ChamferZone.com",
"profileUrl": "Tim Bergholz - ChamferZone.com (@chamferzone)",
"username": "chamferzone",
"account": "basic",
"avatars": {
"uid": "fa47c68dcf6a4d43b804fa1e0fb03964",
"images": [
{
"url": "https://media.sketchfab.com/avatars...fb03964/ff563f9389c242acaf2041fde2547379.jpeg",
"height": 100,
"width": 100,
"size": 3459
},
{
"url": "https://media.sketchfab.com/avatars...fb03964/b374de14bbe143128207f73b1d7cc3e2.jpeg",
"height": 90,
"width": 90,
"size": 3009
},
{
"url": "https://media.sketchfab.com/avatars...fb03964/fd80008b27b44a11a39bfd8c6f65d045.jpeg",
"height": 48,
"width": 48,
"size": 1289
},
{
"url": "https://media.sketchfab.com/avatars...fb03964/15c07027247f48a08b4d84eec4da9a51.jpeg",
"height": 32,
"width": 32,
"size": 801
}
]
}
},
"reviewUrl": "Log in to your Sketchfab account",
"animationCount": 0,
"metadata": {
"animation": null,
"textureFiles": null,
"uvMapped": false,
"materialCount": null,
"scale": null,
"line": null,
"morph": null,
"quad": null,
"hasNormal": null,
"textureCount": null,
"triangle": null,
"polygon": null,
"pbrType": null,
"hasVertexColor": null,
"vertexCount": null,
"hasTangent": null,
"point": null,
"isRigged": false,
"totalTriangle": null,
"sourceFiles": null
},
"isDeleted": false,
"vertexCount": 21847,
"embedUrl": "CX4 Storm - 3D model by Tim Bergholz - ChamferZone.com - Sketchfab",
"displayStatus": "ok",
"editorUrl": "Log in to your Sketchfab account",
"downloadCount": 0,
"isDisabled": false,
"preferOriginalNormalMap": false,
"archiveSize": 816088,
"likeCount": 83,
"isRestricted": false,
"publishedAt": "2016-02-02T21:10:10.206514",
"viewerUrl": "CX4 Storm - 3D model by Tim Bergholz - ChamferZone.com (@chamferzone)",
"name": "CX4 Storm",
"tags": [
"chamferzone",
"substancepainter",
"weapon",
"3dsmax",
"hardsurface"
],
"categories": [],
"uid": "fc6d6067621442ebb6f4238636363d47",
"inStore": false,
"status": {
"processing": "SUCCEEDED",
"warning": {}
},
"processedAt": "2016-02-02T20:44:33.962013",
"commentCount": 4,
"currentVersion": {
"uid": "f69fa14193424761bad5c16f6f45a8c4",
"processedAt": null,
"status": {
"processing": "SUCCEEDED",
"warning": {}
},
"isCurrentVersion": true,
"createdAt": "2018-12-14T19:01:39.352098"
},
"options": {
"updatedAt": "2018-12-14T19:01:39.352123",
"background": {
"uid": "51af6a870cce449eb75b0345feebaebb",
"enable": true
},
"wireframe": {
"color": "88888833",
"enable": false
},
"materials": {
"df56c4b9-6464-429d-b539-504549d295ba": {
"shadeless": false,
"name": "lense",
"reflection": 0.3,
"channels": {
"RoughnessPBR": {
"factor": 0.18,
"color": [
1,
1,
1
],
"enable": true
},
"EmitColor": {
"factor": 0,
"color": [
1,
1,
1
],
"enable": true
},
"BumpMap": {
"factor": 1,
"color": [
1,
1,
1
],
"enable": false
},
"SpecularColor": {
"factor": 0,
"color": [
0.5,
0.5,
0.5
],
"enable": true
},
"Opacity": {
"factor": 0.49,
"color": [
1,
1,
1
],
"enable": true,
"type": "alphaBlend"
},
"DiffusePBR": {
"factor": 1,
"color": [
1,
1,
1
],
"enable": false
},
"NormalMap": {
"factor": 1,
"texture": {
"minFilter": "LINEAR_MIPMAP_LINEAR",
"textureTarget": "TEXTURE_2D",
"uid": "f50a7f1c03624b5f90301a14edf4e5b6",
"wrapS": "REPEAT",
"texCoordUnit": 0,
"magFilter": "LINEAR",
"internalFormat": "RGB",
"wrapT": "REPEAT"
},
"flipY": false,
"enable": true
},
"AlbedoPBR": {
"factor": 0.41000000000000003,
"color": [
0.17673768806827059,
0.19679242063229815,
0.23509307101688112
],
"enable": true
},
"DiffuseIntensity": {
"factor": 1,
"color": [
1,
1,
1
],
"enable": true
},
"SpecularF0": {
"factor": 0.49,
"color": [
1,
1,
1
],
"enable": true
},
"GlossinessPBR": {
"factor": 0.8,
"color": [
1,
1,
1
],
"enable": false
},
"CavityPBR": {
"factor": 1,
"color": [
1,
1,
1
],
"enable": false
},
"DiffuseColor": {
"factor": 1,
"color": [
0.5,
0.5,
0.5
],
"enable": true
},
"MetalnessPBR": {
"factor": 0.89,
"color": [
1,
1,
1
],
"enable": true
},


among all this i tryied getting this value out of name

"name": "CX4 Storm"

the issue im having is i am sure it should be done like the following code i have wrote

var jsonContent1 = File.ReadAllText(Application.StartupPath + "\\textures.json");
var data1 = (JObject)JsonConvert.DeserializeObject(jsonContent1);

var texturesNodeKey1 = "/i/models/fc6d6067621442ebb6f4238636363d47";
var images1 = new Dictionary<string, string>();
foreach (var resultNode in data1[texturesNodeKey1]["name"])
{
var name = resultNode["name"].ToObject<string>();
Name = name;
}


but its telling me reverence is not form of a object

/i/models/fc6d6067621442ebb6f4238636363d47

then the name prop witch i have done but it dont even go into the foreachloop it just stops and exits out of that function not sure what i am doing wrong at this point

Continue reading...
 
Back
Top