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
2

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.