I have written the following code for the printing the JSON in a HTML page.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$.getJSON("http://localhost:8080/json",function(result){
$.each(result, function(i, field){
$("tr").append(field + " ");
});
});
});
</script>
</head>
<body>
<table id="table">
<tr>
<th>market</th>
<th>buy</th>
<th>sell</th>
<th>currency</th>
<th>volume</th>
</tr>
</table>
<div></div>
</body>
</html>
I am able to print the JSON Response values, but was not able to properly print them in a table.
JSON Response format:
{
"market": 1309480,
"buy": 1309480,
"sell": 1280017,
"currency": "INR",
"volume": 2253.4518854
}
Currently how the Table is looking:

tdinside thetr? Also you are appending them to the same place your headers are. You should make use oftheadandtbody.