Skip to content
This repository was archived by the owner on Oct 11, 2020. It is now read-only.

Commit 0651de6

Browse files
Initial commit.
0 parents  commit 0651de6

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jsonpp.judge0.com

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# JSON Pretty Print
2+
> Simple website for pretty printing JSON reponses.
3+
4+
Example: https://jsonpp.judge0.com?https://api.judge0.com/languages.

index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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>

0 commit comments

Comments
 (0)