saptarsi Mondal saptarsi Mondal - 1 year ago 107
jQuery Question

JSON string extract in Jquery

I have a Class Test and it have 2 String varaibles.

Class Test {

String id;
String priority;



I have converted my Class to JSON 'return Response.ok(test).build(); here test is object of Class Test'

Here, I am getting a list of test objects as:


I need to extract the data in Jqery now. I am trying this:

$.each(json, function () {
$.each(this, function (name, value) {
console.log(name + '=' + value);

I need to print the values back to HTML and need to get those values from the list.

Answer Source

What exact HTML do you want to get? Here is an example of parsing JSON and formatting output HTML:

var json = [{"id":"INC0000001","priority":"High"},{"id":"INC0000001","priority":"Low"}];

var ul = $("<ul/>");

$.each(json, function () {
    var li = $("<li/>").text( + ' has ' + this.priority + " priority");

<script src=""></script>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download