c# 4.0 - How to get filepath value from the Json -


i have json file given below

var json={    "attachmentinfo":[         {            "filename":"sign_encrypted_.pdf",          "filepath":"b89ddfa7-af16-4e4d-b16b-b6d49db9b91f",          "filesize":104504.0,          "fileextention":".pdf",          "filetype":2       }    ] } 

i need filepath above json.

i tried

var filepath=(string)json["attachmentinfo"].selecttoken("filepath"); 

but null value return.

thanks in advance help.

first, try deserialize json , can access dynamic object, here snipe code:

string json = ...; var serializer = new javascriptserializer(); serializer.registerconverters(new[] { new dynamicjsonconverter() }); dynamic obj = serializer.deserialize(json, typeof(object)); var filepath = obj.attachmentinfo[0].filepath; 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -