0

I want to store "data" Data :

{
"api_status": 200,
"data": [ 

{"id": "755", "post_id": "755", "publisher": { "username": "test1", "email": "test1@gmail.com"}},
{"id": "765","post_id": "765","publisher": { "username": "test2", "email": "test2@gmail.com"}}

]
} 

I created this to receive data ModelPost.java

public class ModelPost {

    Integer api_status ;
    List<Data> data ;
}

Data.java

public class Data {

    String id, post_id, postText;
    Publisher publisher;

} 

Publisher.java

public class Publisher {

    String username, email;

} 

The problem is in the ModelPost.java file when the data type is List<Data> data ; an error occurs but when I type List<Any> data ; instead of List<Data> data ; I can receive the data but the data is a string

sss
  • 19
  • 4
  • 1
    Does this answer your question? [How to parse JSON in Java](https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java) – mohammedkhan Jun 07 '22 at 21:01
  • `when the data type is List data; an error occurs` can you [edit] the question and tell us what error you are getting? – Shashanth Jun 08 '22 at 03:34

0 Answers0