• 0

[C#] Parsin google translate json result.


Question

5 answers to this question

Recommended Posts

  • 0

Thanks... But i found a good solution. For those who want to take a look, here is the code.

JObject obj = JObject.Parse(json);

JToken translated = obj.SelectToken("data.translations[0].translatedText");

I am using the opensource json parser library "Newtonsoft.Json.dll"

  • 0
  On 17/05/2011 at 01:43, Chanthu said:

Thanks... But i found a good solution. For those who want to take a look, here is the code.

JObject obj = JObject.Parse(json);

JToken translated = obj.SelectToken("data.translations[0].translatedText");

I am using the opensource json parser library "Newtonsoft.Json.dll"

+1 to Json.NET. I'm using it in one project. It's a very very nice library. Much better than using the builtin libraries.

  • 0
  On 18/05/2011 at 11:55, andrew_ said:

Personally I'd set up a POCO that mirrored the results, and then use DataContractSerializer or JavascriptSerializer (now deprecated) and just deserialize it. JSON.NET is just another dependency you don't need.

If a library reduces the amount of work you need to do, why would you not use it?

Using the built in serializers and all that is a lot more work than just 2 lines of code.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.