Answer the question
In order to leave comments, you need to log in
How to convert very large json to java object?
I get json from the backend and translate it into an object using Gson. Like this:
public void saveData(JsonObject data) {
Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new DateDeserializer()).create();
Structure structure = gson.fromJson(data.get("structure").toString(), Structure.class);
//работаю дальше со structure
}
@Parcel(value = Parcel.Serialization.BEAN, analyze = {Structure.class})
public class Structure extends RealmObject {
@SerializedName("id")
@PrimaryKey
@Expose
@Index
public int id;
@SerializedName("date")
@Expose
public String date;
@SerializedName("notes")
@Expose
@ParcelPropertyConverter(RealmListParcelConverter.class)
public RealmList<StructureNote> notes;
//другие поля
Answer the question
In order to leave comments, you need to log in
This article helped https://proandroiddev.com/retrofitting-and-rxjavin...
Gson, like Jackson, has a Streaming API specifically for such cases. True, you have to forget about converting JSON to an object and work with individual fields.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question