GSON stream works for me Gson is streaming , but I have to say that it takes its time, about 4 minutes for 68K rows with 10 columns for example. But still solves my problem. So I have a JSON response:
- preciosArtPK: { codLista: 1, codArticulo: 11348, cansiVenta: 1, fecVigencia: 1435781252000 }, siglaVenta: "UN", precioVenta: 0, margenPct: 100, codUsuario: 1, vigente: "S", nomModulo: "MIGRACION"
The above JSON is part of the array response, but I have these "preciosArtPK" for inclusion in serialization using gson. How could I do this? I have a class that handles my serialization:
@DatabaseTable(tableName = "preciosart") public class PreciosArt { public static final String PRECIOS_COD_LISTA = "_id"; public static final String PRECIOS_COD_ARTICULO = "cod_articulo"; public static final String PRECIOS_CANSI_VENTA = "cansi_venta"; public static final String PRECIOS_FEC_VIGENCIA = "fec_vigencia"; public static final String PRECIOS_SIGLA_VENTA = "sigla_venta"; public static final String PRECIOS_PRECIO_VENTA = "precio_venta"; public static final String PRECIOS_MARGEN_PCT = "margen_pct"; public static final String PRECIOS_COD_USUARIO = "cod_usuario"; public static final String PRECIOS_VIGENTE = "vigente"; public static final String PRECIOS_NOM_MODULO = "nom_modulo"; @DatabaseField(id = true, unique = true, columnName = PRECIOS_COD_LISTA) private Integer codLista; @DatabaseField(unique = true, columnName = PRECIOS_COD_ARTICULO) @SerializedName("codArticulo")
but it does not fill in these fields (codArticulo, cansiVenta and fecVigencia). I read about deserializing these json formats creating another class, so I did the same:
@SerializedName("codLista") private Integer codLista; @SerializedName("codArticulo") private Integer codArticulo; @SerializedName("cansiVenta") private Integer cansiVenta; @SerializedName("fecVigencia") private Long fecVigencia;
The problem is this: how could I populate this field using json deserialized? I am using OMRLite to do this job, this class is for this purpose:
public long updatePreciosart(PreciosArt preciosArt){ long resultUpdate = -1; try { getHelper().getPreciosartDao().createOrUpdate(preciosArt); resultUpdate = 0; } catch (SQLException e) { e.printStackTrace(); resultUpdate = -1; } return resultUpdate; }
I hope you understand what the problem is, and I hope that you will help me! Thanks again!