0

I have a web service that gives me a json with this format:

In case of positive login: ["67", 1];

In the negative: ["fail", "Data entered for the user is incorrect."]

How to properly deserialize?

I have tried :

Dim ser As New JavaScriptSerializer()
Dim result = ser.Deserialize(Of LoginResult)(wsResult.ToString())

Public Class LoginResult
   Public Property idcliente As String
   Public Property idutente As String
End Class
peter
  • 14,348
  • 9
  • 62
  • 96
  • For the C# part this could help you https://stackoverflow.com/questions/7895105/deserialize-json-with-c-sharp – Pumkko Nov 14 '17 at 10:07
  • Possible duplicate of [Deserialize json array in vb.net](https://stackoverflow.com/questions/4868863/deserialize-json-array-in-vb-net) – Filip Cordas Nov 14 '17 at 10:19

1 Answers1

1

You can use newtonsoft.JObject

   Dim json as jObject = JObject.Parse(yourJson)
    If (json.SelectToken("fail") = null)
      \\do somting
    If (json.SelectToken("67") = null)
      \\do somting
Oren Tamam
  • 33
  • 3