I have an app written in C# with version 2.0 of the .NET Framework. Unfortunately, I do NOT have the option of updating to a newer version of .NET.
My app is calling a webservice that returns some JSON. The returned JSON looks something like the following:
{"Status":1, "ID":"12345"}
I need parse this string and get the respective Status and ID values. If I was using a later version of the .NET framework, I would use the System.Json
namespace. However, I do not have that luxury. I have no idea how to parse this response.
Does anyone know how I can parse this with C# in .NET 2.0?
Yes, James Newton-King's JSON.NET supports .NET 2.0, and is fairly simple to work with.
I have used it numerous times, where .NET's JavaScriptSerializer just didn't cut it.
you can, and should, do that with this library http://james.newtonking.com/pages/json-net.aspx
I was able to backport Mono's implementation of System.Json to C# 2.0 with a few minor changes.
You'll need 6 files from here or you can simply download my C# 2.0 project from here.
You should be able to use JSON.NET and here is the article describing this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With