VoimiX
VoimiX

Reputation: 1200

How to deserialize a simpe json array in asp.net mvc?

I have a simple JSON array like this :

"{0: "4", 1: "5"}"

How can I deserialize this JSON array in ASP.NET MVC?

Upvotes: 0

Views: 4704

Answers (1)

Erik Schierboom
Erik Schierboom

Reputation: 16636

Most ASP.NET MVC applications use the JSON.NET library for that purpose. In that case you would do:

var numbers = JsonConvert.DeserializeObject<List<string>>("{0: \"4\", 1: \"5\"}");

Upvotes: 2

Related Questions