This is a small APEX Plugin which adds a JSON Object into a JavaScript variable based on SQL or PL/SQL into the page at render time. You can see a demo here.