Filter data from a JSON

Asked

Viewed 53 times

1

I would like to filter some data from a JSON returned from a query, in order to return a list with the title and value of each property.

code I’m trying to modify:

      var titulo = Object.keys(retorno);

      for(var i = 0; i < titulo.length; i++){

           console.log(titulo.i);

      }


    var conteudo = Object.values(retorno);

 $("table").append(`<tr id='t_titulo'>
                        <th>${titulo}</th>
                            </tr>
                        <td id='t_conteudo'>
                       ${conteudo}</td>
                    </tr>`);

1 answer

1


I was able to find

      var tamPerson = Object.keys(retorno).length;

      $.each(retorno, function(key, val) {
     $("table").append("<tr id='t_titulo'><th>" + key + "</th></tr><td id='t_conteudo'>" + val + "</td></tr>");

});
  • You can close the question or post the object to supplement your question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.