Skip to content

Instantly share code, notes, and snippets.

@damien5314
Created June 30, 2017 03:20
Show Gist options
  • Save damien5314/1e4bbc8ad24b673c258fc5593f65f585 to your computer and use it in GitHub Desktop.
Save damien5314/1e4bbc8ad24b673c258fc5593f65f585 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JSON Pretty Print</title>
</head>
<body>
<textarea id="input" rows="40" cols="64" placeholder="Paste JSON here"></textarea>
<textarea id="output" rows="40" cols="64" readonly="readonly" placeholder="Result"></textarea>
<br />
<input type="submit" id="submit">
<script>
function execute() {
var input = document.getElementById("input").value
var output = document.getElementById("output")
output.textContent = JSON.stringify(JSON.parse(input), null, 2)
}
document.getElementById("submit").onclick = execute
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment