-1

I am looking to use this JSON interface:

https://translate.yandex.net/api/v1.5/tr.json/translate ?
key=<API key>
& text=<text to translate>
& lang=<translation direction>
& [format=<text format>]
& [options=<translation options>]
& [callback=<name of the callback function>]

More info

It returns a JSON object. How do I get that JSON object in Java?

I know there already is an implementation for that exact API, but it's old and not working anymore.

John Hascall
  • 9,176
  • 6
  • 48
  • 72
  • Use a Java REST client, there are plenty to choose from: http://stackoverflow.com/questions/221442/rest-clients-for-java – Genti Saliu Feb 05 '16 at 19:18
  • Welcome to StackOverflow. Please read our [ask] page for help on how to ask a great question. Great questions get faster, better answers by the community – blurfus Feb 05 '16 at 19:19
  • There are a ton of libraries and clients available for this. A simple google search will take you a long way. – basic Feb 05 '16 at 19:24
  • `JSONObject jObj = new JSONObject(your json here once you get it)` – Sumit Sahay Feb 05 '16 at 19:24
  • Are you asking how to do the HTTPS call, or how to parse the returned JSON data, or a solution doing both for you? If latter, use suggestion by @GentiSaliu above. – Andreas Feb 05 '16 at 19:27

2 Answers2

0

I've had good results using google's gson library. Really this depends on what you are doing with the JSON data - is it a rest payload, JMS message or what? A lot of stuff understands JSON natively now so don't reinvent the wheel.

TheFiddlerWins
  • 860
  • 5
  • 19
0

Yandex.Translate API documentation can be found here:

With the API, you can access the online machine translation service Yandex. It supports more than 60 languages and can translate single words and whole texts. This API allows you to embed Yandex.Translate in a mobile application or web service for end users. Or, to translate large volumes of text - such as technical documentation.

Roman C
  • 49,761
  • 33
  • 66
  • 176