Simply displaying JSON data for users: what is your preferred method?

I’m looking to avoid overwrought template frameworks; the idea is that 
I have a data-centric app that needs to display arbitrary JSON input, 
but do a bit more than just pretty print it.  I wouldn’t be opposed to 
*some* small amount of customization in the look for the more 
structured info, but it would need to come with low overhead and be 
easy to drop in for someone (like a research scientist) that doesn’t 
know a lot about HTML or JavaScript/JSON beyond the basic syntax.

My starting approach was to just drop a .toHTML() method on object 
prototypes that kicks out some appropriate markup (e.g., Array items 
become <li> elements).  It works well enough, but it’s already clear 
that I’m going to need to factor things out to some kind of framework 
if I want to get fancy.  Something straightforward must already exist!

No event hooks needed.  No $global objects for tricky manipulation of 
the DOM necessary.  No grand visions to transform JavaScript into a 
whole new language wanted.  I just have data that I want to make semi-
attractive in a web page.

If it scales *up* to those other things it’s probably a bonus, but 
I’m really hoping to find something that scales down.  I’ve found a 
couple likely candidates, but I’m wondering if there’s anything really 
popular on the small end of the scale, or must the framework starting 
point be a dependency on jQuery these days.

12/24/2016 4:15:21 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

0 Replies

Similar Articles

[PageSpeed] 57