Answer the question
In order to leave comments, you need to log in
VB.Net and XML. Extract values?
It is necessary to pull out first_name and last_name from this into a VB.Net variable.
{"response":[{"uid":238005056,"first_name":"Самый-Лучший","last_name":"День"}]}
Answer the question
In order to leave comments, you need to log in
Is this not Json for an hour?
Here is a good Open Source library: Json.NET
Documentation
Including
, importingImports Newtonsoft.Json.Linq
Dim str = "{'response':[{'uid':238005056,'first_name':'Самый-Лучший','last_name':'День'}]}"
'Парсим Json строку'
Dim JObj As JObject = JObject.Parse(str)
'Парсим значение массив ключа "response"'
Dim JArr As JArray = JArray.Parse(JObj("response").ToString)
'Берём первый элемент массива и парсим как обычную Json строку'
Dim JArrItems As JObject = JObject.Parse(JArr.First.ToString)
'Загоняем в переменные значения ключей "first_name" и "last_name"'
Dim first_name = JArrItems("first_name").ToString,
last_name = JArrItems("last_name").ToString
Dim str = "{'response':[{'uid':238005056,'first_name':'Самый-Лучший','last_name':'День'}]}"
Dim JArrItems As JObject = JObject.Parse(JArray.Parse(JObject.Parse(str)("response").ToString).First.ToString)
Dim first_name = JArrItems("first_name").ToString,
last_name = JArrItems("last_name").ToString
Dim str = "{'response':[{'uid':238005056,'first_name':'Самый-Лучший','last_name':'День'}]}"
Dim JObj As JObject = JObject.Parse(str)
Dim first_name = JObj("response")(0)("first_name").ToString,
last_name = JObj("response")(0)("last_name").ToString
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question