Mapping a json as an html table

1

I have the following json:

    {
    "codEmp": 5555,
    "empleado": [{
        "codEmp": "0001",
        "descEmp": "Juan Perez",
        "importe": {
            "minimo": 10,
            "maximo": 2500
        },
        "pariente": [{
            "parentesco": "esposa",
            "nombre": "Julia"
        }, {
            "parentesco": "hijo",
            "nombre": "Marcelo"
        }],
        "tarjetas": [{
            "codTarjeta": "V",
            "descTarjeta": "Visa"
        }]
    }, {
        "codEmp": "1488",
        "descEmp": "Sergio",
        "importe": {
            "minimo": 100,
            "maximo": 25000
        },
        "pariente": [{
            "parentesco": "esposa",
            "nombre": "Fernanda"
        }, {
            "parentesco": "hijo",
            "nombre": "Maria"
        }],
        "tarjetas": [{
            "codTarjeta": "V",
            "descTarjeta": "Visa"
        }, {
            "codTarjeta": "A",
            "descTarjeta": "America"
        }]
    }]
}

I would need to visualize it on an html page.

I'm trying with link , if I have "codEmp" and a list I can do it, but it's complicated when I have a list within another list to show it in a table.

    
asked by alejogabriel 09.08.2016 в 21:10
source

1 answer

1

It is not very clear if you want to show the json itself, or put its content in a table.

But why not try with json_decode of php and you are accessing the fields?

$json_decodificado = json_decode($tu_json)

echo $json_decodificado->codEmp (5555)
echo $json_decodificado-> empleado->codEmp (0001)

This is with php , since you do not specify which language you work with, I hope that it solves the problem or leads you to the solution.

I leave you the documentation of php :

  

link

Greetings

    
answered by 09.08.2016 в 22:05