I need to add to this result, in each position, some data that I have in json.getJSONObject(l)
at the end of the ones I already have.
But according to what I have what it does is replace the data that already exists in datosReserva.getJSONArray("lineas");
the position I choose (l).
This is my code
JSONObject desglosePrecios = obtenerDesglosePrecios(localizador, afilage, usuario.getCodigousu(), usuario.getClausu(), usuario.getAfilusu(), datosReserva.getString("secacc"), datosReserva.getString("integrCamDiv"));
datosReserva.put("desglosePrecios", desglosePrecios);
JSONObject obj = datosReserva.getJSONObject("desglosePrecios");
JSONArray json = obj.getJSONArray("desgloseLineas");
JSONArray lineas = datosReserva.getJSONArray("lineas");
JSONArray linea = new JSONArray();
for (int l = 0; l < lineas.length(); l++) {
linea.put(json.getJSONObject(l));
lineas.put(l, linea.getJSONObject(l));
}