Brwa R. Hassan
Brwa R. Hassan

Reputation: 105

Search in a json API using VB.net

hello guys i want to search in a json string and get a value of one of the attribute i have the following code

    Dim ser As JObject = JObject.Parse(reader.ReadToEnd())

    Dim data As List(Of JToken) = ser.Children().ToList

    Response.Write(ser)

and this is my out put

{ "success": true, "result": { "access_token": "T1RLAQLTD+AB7uveLzir/oF8EKbu32EJIRDHKkx5O/W2+ri3cbWT8uOuAADAF7OJij6m20nPrYZzWRwNlDA99fzg/pnN7eL8XiWS9pkvapQtPDhiPHupNJOettLKPJRuekAO0zBgptPAkYt1G6etINlTjHLpW2kVOxeAqH7t3mSzXmScSQvgQwMC2d4FBdZu2jKgSf86ret2i0eHydFW91vJ1eWI9LkZFPrHBXPzlQJZ9GyvFpF2IEVo2D23y3xMYYEVI410ZRKLnTLvTcrH12s/8wYNc8jKLMWKcNNjiKnDm8i0WJS7eOU7iXKu", "token_type": "bearer", "expires_in": 604800 } }

i want to get the value of that "access_token" thank you

Upvotes: 0

Views: 470

Answers (1)

Carlos
Carlos

Reputation: 1822

You can get it without using ToList() first:

Dim myAccessToken as String = ser("result")("access_token").Value(Of String)()

I haven't checked it, but I think this should work.

Upvotes: 1

Related Questions