0

[ASK] C# Xamarin JSOn

String a = "{\"success\":1,\"message\":\"successfully created.\"}";
string b = "{"success":1,"message":"successfully created."}";

how to get value success and message in JSON ?

1

1 Answer 1

1

Given the class model of (via http://jsonutils.com):

public class Example
{
    public int success { get; set; }
    public string message { get; set; }
}

Usage:

var a = "{\"success\":1,\"message\":\"successfully created.\"}";
var example = JsonConvert.DeserializeObject<Example>(a);
Console.WriteLine($"{example.success} : {example.message}");

Output:

1 : successfully created.
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.