I'm actually trying to avoid building JSON structures from strings since writing & maintaining that code is a pain.  The JavaScript code has to be built using a string but I'd like to get that into a templating system so that it is more maintainable.