How can I write data from the received jason to the database skylight?

Class of arrays of values:

public class Example { @SerializedName("values") @Expose private List<Value> values = null; public List<Value> getValues() { return values; } } 

Class of values:

 public class Value { @SerializedName("title") @Expose private String title; @SerializedName("year") @Expose private String year; @SerializedName("genre") @Expose private List<String> genre; @SerializedName("director") @Expose private String director; @SerializedName("desription") @Expose private String desription; @SerializedName("image") @Expose private String image; public String getTitle() { return title; } public String getYear() { return year; } public List<String> getGenre() { return genre; } public String getDirector() { return director; } public String getDesription() { return desription; } public String getImage() { return image; } } 

Each object must be entered into the database so that you can interact with them. Thank.

  • 1 create a table with the required fields, then make a DB insert into it - Romanych
  • As an option, you can save a simple json string in the database, and continue to work with it - Rasul A-s

1 answer 1

Perhaps, you will suit such an example of working with Room sample.

I recommend you with the documentation