Reputation: 3952
Is there a native library that would allow me to parse a Json formatted string? Say, for example, I had the string:
string inp = "{ \"title\": \"My Title\" }";
Is there a class where I can construct an object using that Json formatted string and find the value for title
?
Edit: My app is a console application.
Upvotes: 3
Views: 2303
Reputation: 5551
You should check out Json.Net http://json.codeplex.com/ It has all sorts of great tools for supporting Json in. Net
Upvotes: 1
Reputation: 15557
Not a native but a powerful one: Json.NET
Upvotes: 3
Reputation: 101594
Depending on the type of project, JavaScriptSerializer may be available. Also allows you to create parsers that can populate custom objects.
Upvotes: 1
Reputation: 150108
You can use the DataContractJsonSerializer to deserialize a Json formatted string into an object
http://msdn.microsoft.com/en-us/library/bb410770.aspx
For better performance, if you're willing to install a NuGet package,
is quite popular.
Both alternatives work for a console application.
Upvotes: 5