Check out the JSON2HTML http://json2html.com/ plugin for jQuery. This allows you to specify a conversion that will convert your JSON object to an HTML template. Use the constructor at http://json2html.com/ to get the json transform object for any desired HTML template. In your case, it will be a table with a row having the following conversion.
Example:
var transform = {"tag":"table", "children":[ {"tag":"tbody","children":[ {"tag":"tr","children":[ {"tag":"td","html":"${name}"}, {"tag":"td","html":"${age}"} ]} ]} ]}; var data = [ {'name':'Bob','age':40}, {'name':'Frank','age':15}, {'name':'Bill','age':65}, {'name':'Robert','age':24} ]; $('#target_div').html(json2html.transform(data,transform));
Chad Jun 23 '11 at 18:57 2011-06-23 18:57
source share