Obtener datos JSON en la tabla HTML [cerrado]

"error": [],
"result": {
    "DATA": {
        "asks": [

I am new in JSON reading HTML. Here is my JSON String and i want to read "ask" matriz and display it in Table.The type of getting JSON data from the server is type: 'GET'.

Please give me any sample example.

Gracias de antemano.

preguntado el 27 de noviembre de 13 a las 06:11

Please show us your javascript code. -

2 Respuestas

After storing your Json data in a variable

var data = {.....};
data = JSON.parse(data);

you can access the asks array with dot notation this way:

var dataArray = data.result.DATA.asks;

then you can do whatever you want with the array in the dataArray variable.

You can also do this in the success function of your Get request, assuming that you are using $.ajax, here is a jQuery based solution.

   url:"data source",
      var tableBody = "";
      $.each(data.result.DATA.asks, function() {
         var row = "";
         this.forEach(function(v) {
            row += "<td>"+v+"</td>";
       tableBody += "<tr>"+row+"</tr>";                 

The above example is to give you an idea on how to go over your array and add the data to the body. The following is a better option:

 var tableBody = data.result.DATA.asks.map(function(value){

    return "<tr>"+value.map(function(k){
        return "<td>"+k+"</td>";


here you have only to append the string tableBody to the HTML dom in a div of you choice.

respondido 27 nov., 13:07

$.getJSON( "ajax/test.json", function( data ) {
  var items = [];
  $.each( data, function( key, val ) {
    items.push( "<li id='" + key + "'>" + val + "</li>" );

  $( "<ul/>", {
    "class": "my-new-list",
    html: items.join( "" )
  }).appendTo( "body" );

this example is fetched from jquery.com , cosnider replacing list with your table


respondido 27 nov., 13:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.