I have this JSON object and I want to navigate trought it with javascript or jquery, how can I do that?
{
"Fporder": {
"cep_id": "300000007",
"user_id": "300000192",
"fporder_type_id": 2,
"agency_id": null,
"fporder_code": 1,
"id": "66"
},
"FpordersProduct": [
{
"product_id": "1938",
"requested": "4",
"price": 3965,
"product_name": "PLANCHA DE LASAGNA PRE COCIDO X KL",
"product_code": "22044001"
}
]
}
EDIT:
Please I'm getting this error:
Uncaught TypeError: Cannot read property 'product_id' of undefined
I have tried these with no success:
json_object.FpordersProduct.product_id
OR
json_object.FpordersProduct[0].product_id
OR
json_object.FpordersProduct[0]['product_id']
But it does not work. Please Help.
EDIT2
function agregar_fporder(fporder)
{
console.log('agregar_fporder() ejecutado');
console.log("fporder: "+fporder);
var tr = '';
tr += '<tr class="item fporder">';
tr += '<td class="nro_orden"></td>';
tr += '<td class="id">'+fporder.FpordersProduct.product_id+'</td>';
tr += '<td class="code">'+fporder.FpordersProduct.product_code+'</td>';
tr += '<td class="name">'+fporder.FpordersProduct.product_name+'</td>';
tr += '<td></td>';
tr += '<td></td>';
tr += '<td></td>';
tr += '<td></td>';
tr += '<td></td>';
tr += '<td class="nro_pedido">';
tr += '</td>';
tr += '<td class="quantity">';
tr += '</td>';
tr += '<td class="um_id">';
tr += '</td>';
tr += '<td></td>';
tr += '<td>';
tr += '</td>';
tr += '<td></td>';
tr += '<td></td>';
tr += '</tr>';
var item = $('table#items tr.items.fporder').find('td.code input.code[value="'+fporder.FpordersProduct.product_code+'"');
console.log('item: '+item);
}