This repository was archived by the owner on Oct 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ jsonpp.judge0.com
Original file line number Diff line number Diff line change
1
+ # JSON Pretty Print
2
+ > Simple website for pretty printing JSON reponses.
3
+
4
+ Example: https://jsonpp.judge0.com?https://api.judge0.com/languages .
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js " integrity ="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo= " crossorigin ="anonymous "> </ script >
5
+ < title > JSON Pretty Print</ title >
6
+ < style >
7
+ # content {
8
+ font-family : 'Courier New' , Courier, monospace;
9
+ }
10
+ </ style >
11
+ </ head >
12
+ < body >
13
+ < pre id ="content "> </ pre >
14
+ < script type ="text/javascript ">
15
+ $ ( document ) . ready ( function ( ) {
16
+ var $content = $ ( "#content" ) ;
17
+ var url = location . search . substr ( 1 ) . trim ( ) ;
18
+ if ( url === "" ) {
19
+ $content . html ( "<p style=\"color: red;\">Please provide URL.</p> Example: https://jsonpp.judge0.com?<strong>https://api.judge0.com/languages</strong>" ) ;
20
+ }
21
+ else {
22
+ $ . ajax ( {
23
+ url : url ,
24
+ type : "GET" ,
25
+ success : function ( data , textStatus , jqXHR ) {
26
+ if ( typeof data === "object" ) {
27
+ $content . html ( JSON . stringify ( data , null , 4 ) ) ;
28
+ }
29
+ else {
30
+ $content . html ( "<p style=\"color: red;\">Response is not a JSON.</p>" ) ;
31
+ }
32
+ } ,
33
+ error : function ( jqXHR , textStatus , errorThrown ) {
34
+ $content . html ( JSON . stringify ( jqXHR , null , 4 ) ) ;
35
+ }
36
+ } ) ;
37
+ }
38
+ } ) ;
39
+ </ script >
40
+ </ body >
41
+ </ html >
You can’t perform that action at this time.
0 commit comments