Benefit of outputting JSON as opposed to plain HTML
- by Franco
Hey guys,
Just wondering which is best here. I want to output data from a table in my DB then put a lot of this data into a html table on the fly on my page. Im working with Java on the server side. Basically I pull the results form the DB and have the raw data..just what next?
There is a chance I may want to take data from multiple tables in order to combine it into one table for my site.
I retrieve the results of the query from the DB, now do i create a text from it in the form of json which i can parse as json using jquery upon the return of the object to my browser?(kind of a sub question of this question: Is just using a stringbuilder the correct way to make a json object to output?)
Or..
Should i build the HTML as a string and output that to the browser instead?
Which is better and why?
Thanks in advance!