1

I have troubles with parsing of server response using retrofit. Server returns array of strings, how it's possible to parse this: ["1", "21", "22"] using retrofit framework. I'm using Retrofit 2.0.0-beta2. Thanks

1
  • 1
    Please add your existing code so that we can understand it better! And also include the errors you face while trying your way! Commented Oct 19, 2015 at 17:04

1 Answer 1

6

To parse that response define your method in API interface like this:

@GET("methodThatReturnsArray")
Call<ArrayList<String>> methodThatReturnsArray();

Synchronous call would look like

Call<ArrayList<String>> call = retrofitService.methodThatReturnsArray();
Response response = call.execute();
ArrayList<String> arrayOfStrings = response.body();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.