Reputation: 2269
I am trying to implement the Google Translation API into my project. While reading the docs here. It says to
Create a JSON request file with the following text, and save it as a translate-request.json plain text file like this:
{
'q': 'The quick brown fox jumped over the lazy dog.',
'source': 'en',
'target': 'es',
'format': 'text'
}
How do I go about doing this and where in my project would I save it?
Upvotes: 0
Views: 58
Reputation: 1
The example is a json file stored on your default IDE folder for your projects. Then you continue with the next step using docs guideline.
Upvotes: 0
Reputation: 335
OK, the docs you linked are only an example, that explains how the API works. But it is unrelated to Android development. As you probably want to query more than one sentence: In real code you would generate the json data as string on the fly. In Java there is the JSONObject (tutorial).
But a better way is to use one of the Java client libraries that does all that work for you. The docs you linked to had another link to this page, (next to the code click on Java). And here is how to install the client lib.
Upvotes: 1