My gut feel is that it'd be easier to leave this an API that just returns whatever it has and leaves the JS application to make sense of it.