Как разобрать строку json в ASP.NET с помощью C#?
Я хочу разобрать строку json в asp.net с помощью c#. Я читаю строку json из настроенного файла json. Я хочу получить значения,связанные с bankid, паролем
в разделе entityDetails и request при тестировании приведенной ниже строки json.
Моя текущая строка json выглядит следующим образом:
{ "WebserviceRequest": { "entityDetails": { " bankid ": "", "password": "", "signature": "", "userName": "", "“timestamp”": "””" }, "Test": { " request ": "", "response": "", } } }
Что я уже пробовал:
My current json string is as below: <pre>{ "WebserviceRequest": { "entityDetails": { " bankid ": "", "password": "", "signature": "", "userName": "", "“timestamp”": "””" } } }
Я читаю файл json, как показано ниже:
string jsonFile = "URIParam.json"; string jsonfilePath = ConfigurationSettings.AppSettings["jsonfilePath"].ToString().Trim()+ jsonFile; using (StreamReader reader = new StreamReader(jsonfilePath)) { jsonstring = reader.ReadToEnd(); // Read the content. }