Created
August 18, 2020 13:26
-
-
Save Heavyblade/74de132b491b81c89a73758d5bbf557f to your computer and use it in GitHub Desktop.
json.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ------------------------------------------------------------------------------------------ | |
* Armamos el JSON de retorno | |
* ------------------------------------------------------------------------------------------ | |
**/ | |
var json = {}; | |
var PedidosCabecera = oJson_laListaPedidos.vta_ped_g; // JSON con datos de la cabecera | |
var PedidosLineas = oJson_lineas.vta_ped_lin_g; // JSON con datos de las lineas. (Plural) | |
for (var key in PedidosCabecera) { | |
var idPedido = PedidosCabecera[key].id; | |
PedidosCabecera[key].lineas = []; | |
for( var j in PedidosLineas) { | |
if (idPedido === PedidosLineas[j].vta_ped) { | |
PedidosCabecera[key].lineas.push(PedidosLineas[j]); | |
} | |
} | |
} | |
alert(JSON.stringify(PedidosCabecera)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment