Display formatted JSON

  1. #1

    Display formatted JSON

    I'm trying to create a page to show some JSON.
    Something like this fiddle

    I can get the JSON to display in a panel
    <ext:Panel runat="server" Region="Center" Layout="FitLayout" Html="<pre id='someJson'></pre>">
    ...
    document.getElementById("someJson").innerHTML = JSON.stringify(result, undefined, 4);
    Click image for larger version. 

Name:	Capture.PNG 
Views:	58 
Size:	6.2 KB 
ID:	25255

    But it not formatted properly.
  2. #2
    NVM got it.
    Just put the pre tag after EXT controls, which works in this instance
    ...
    </ext:FormPanel>			
    <pre id="jsond"></pre>
    </body>
    
    ...
    document.getElementById("jsond").innerHTML = JSON.stringify(a, null, 2);

Similar Threads

  1. [CLOSED] Binding formatted datetime
    By odyssey in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 14, 2013, 6:23 AM
  2. [CLOSED] Server tag is not correctly formatted
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 29, 2010, 10:14 AM
  3. Replies: 2
    Last Post: Oct 05, 2010, 10:29 AM
  4. [CLOSED] Date Value is not getting formatted during Edit mode in Grid Panel
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 11, 2010, 7:41 PM
  5. Replies: 3
    Last Post: May 11, 2010, 4:47 AM

Tags for this Thread

Posting Permissions