Hello to all. There is a string

[{ "name":"TEXT", "author": { "name": "ololo" } }, { "name":"TEXT2", "author": { "name": "ololo" } }] 

To retrieve the name problem does not occur. I use the following code:

 Gson gson = new Gson(); Parse[] parse = gson.fromJson(str, Parse[].class); for (int i = 0; i < parse.length; i++) { String name = parse[i].getName().toString(); } 

But how do I get the name from author ?

    1 answer 1

     public class Parse { private String name; private Author author; public String getName() { return name; } public Author getAuthor() { return author; } } public class Author { private String name; public String getName() { return name; } } 
    • that is necessary. thank! - odradek
    • one
      @odradek If the answer is correct, mark it as accepted and if everything is alright, do not forget to raise the reputation of @falstaf - Barmaley