Permalink
Find file
ce5d829 Nov 1, 2016
@finom @umbrae @closacco
254 lines (242 sloc) 9.38 KB
<!DOCTYPE html>
<html>
<head>
<!--<script type="text/javascript" src="http://s.servedby-buysellads.com/266667.js"></script>-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="JSON Lint is a web based validator and reformatter for JSON, a lightweight data-interchange format.">
<title>
JSONLint - The JSON Validator.
</title>
<link rel="stylesheet" href="css/codemirror.css">
<link rel="stylesheet" href="css/style.css">
<script>
(function() {
var otherParams = [];
function parseParams(params) {
var splittedParams = params.split('&');
var onloadJSONParameter;
splittedParams.forEach(function(item) {
var keyValue = item.split('=');
if(keyValue[0] === 'json') {
onloadJSONParameter = decodeURIComponent(keyValue[1]);
} else {
otherParams.push(item);
}
});
if(onloadJSONParameter) {
localStorage.onloadJSONParameter = onloadJSONParameter;
// remove the last &
document.location.search = otherParams.join('&');
}
}
if(location.search) {
parseParams(location.search.substr(1));
}
})();
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-69209117-1', 'auto');
ga('send', 'pageview');
</script>
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/3533890/Test', [728, 90], 'div-gpt-ad-1468936444454-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<script src="blockfreead.php" type="text/javascript"></script>
<script src="register-service-worker.js" defer></script>
</head>
<body>
<main>
<header>
<div id="headings">
<h1 id="headerText">
JSONLint
</h1>
<h3>
The JSON Validator
</h3>
<a href="http://pro.jsonlint.com" class="pro" target="_blank">Try PRO →</a>
</div>
<aside id="aside">
<!--<div id="bsa_1303970" data-serve="1303970" style="height: 90px;width: 728px;;"><script type='text/javascript'>_bsajs.drop('bsa_1303970');</script></div>-->
<!-- /3533890/Test -->
<div id='div-gpt-ad-1468936444454-0' style='height:90px; width:728px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1468936444454-0'); });
</script>
</div>
</aside>
<script src="dummy-ads.js"></script>
<script>
window.onload = function() {
var dummyAds = document.getElementById('adsense');
if (!dummyAds || getComputedStyle(dummyAds).display !== 'block') {
document.querySelector('#aside').innerHTML = blockFreeAd;
}
}
</script>
</header>
<form name="main">
<textarea id="code" name="code"></textarea>
<div style="clear: both;width: 100%;display: block;"></div>
<div class="validate thirty">
<button type="submit" data-ga="validate">Validate JSON</button>
<button type="reset" data-ga="clear">Clear</button>
</div>
<div class="seventy">
<div style="clear: both;width: 100%;height: 10px;display: block;"></div>
<div class="fourty pad">
<div class="ads">this is an AD &rarr;</div>
</div>
<div class="sixty pad">
<div id="textcta"></div>
<script>
document.querySelector('#textcta').innerHTML = blockFreeAd
</script>
</div>
</div>
<div style="clear: both;width: 100%;display: block;"></div>
</form>
<section id="result-container">
<h3>Results</h3>
<pre id="result"></pre>
</section>
<footer>
<aside>
<a href="https://www.github.com/circlecell/jsonlintdotcom" data-ga="sourceLink">Source is on GitHub</a>. Props to <a href="http://www.crockford.com/">Douglas Crockford</a> of <a href="http://www.json.org">JSON</a> and <a href="http://www.jslint.com">JS Lint</a> and <br /><a href="http://zaa.ch/">Zach Carter</a>, who provided the <a href="https://github.com/zaach/jsonlint"> pure JS implementation of jsonlint</a>.
</aside>
<nav>
<a href="#" data-ga="faq" id="faqButton">FAQ</a>
<a href="https://buysellads.com/buy/detail/266667" target="_blank" data-ga="advertise">Advertise</a>
</nav>
</footer>
<article id="faq">
<h3>
FAQ
</h3>
<hr>
<div id="faqAccordion">
<h5>
What is JSONLint?
</h5>
<div>
<p>
JSONLint is a validator and reformatter for <a href="http://www.json.org/">JSON</a>, a lightweight data-interchange format.
</p>
</div>
<h5>
Why 'Lint'?
</h5>
<div>
<p>
Essentially, I'm just riding on <a href="http://www.jslint.com">JSLint's</a> coattails. The name 'lint' was originally used to find problems in C source files. It's not really valid here because JSON is just a protocol. Shameless? You bet!
</p>
</div>
<h5>
Why does it reformat my JSON?
</h5>
<div>
<p>
Because your code is ugly! Trust me on this one. What's that you say? It's not? Ok, well then here's <a href="/?reformat=no">JSON Lint without the reformatter.</a>
</p>
</div>
<h5>
Any secret features?
</h5>
<div>
<p>
Sure, a few. You can input a URL and it'll scrape it for JSON and parse that.<br>
An example URL to test: <a href="/?json=http%3A%2F%2Fwww.reddit.com%2Fr%2Fprogramming%2Fcomments%2F9szpc%2Fjsonlint_a_handy_json_validator_and_reformatter.json" data-ga="redditUrlInput">http://www.reddit.com/r/programming/comments/9szpc/jsonlint_a_handy_json_validator_and_reformatter.json</a>
</p>
<p>
You can also provide JSON to lint in the URL if you link to JSON Lint with the "json" parameter. <a href="/?json=%7B%22hello%22%3A%20%22world%22%7D">Here's an example URL to test.</a>
</p>
<p>
Additionally, <a href="/?reformat=compress">JSON Lint can also be used as a json compressor if you add ?reformat=compress to the URL.</a>
</p>
</div>
<h5>
What are some common errors?
</h5>
<div>
<dl>
<dt>
<code>Expecting 'STRING'</code>
</dt>
<dd>
You probably have an extra comma at the end of your collection. Something like: <code>{ "a": "b"<span class="highlight">,</span> }</code>
</dd>
<dt>
<code>Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['</code>
</dt>
<dd>
You probably have an extra comma at the end of your list. Something like: <code>[ "a", "b"<span class="highlight">,</span> ]</code>
<br>
You also may have not enclosed your collection keys in quotes. Proper format for a collection is: <code>{ "key": "value" }</code>
</dd>
</dl>
<p>
Be sure to follow <a href="http://www.json.org/">JSON's syntax</a> properly. For example, <strong>always use double quotes, always quotify your keys, and remove all callback functions</strong>.
</p>
</div>
<h5>
A friend and I pasted the same JSON in and got different results. Wat do?
</h5>
<div>
<p>
If you and your friend are on different systems (Win/Unix), this is possible due to the way windows handles newlines. Essentially, if you have just newline characters (\n) in your JSON and paste it into JSONLint from a windows machine, it can validate it as valid erroneously since Windows may need a carriage return (\r) as well to detect newlines properly.
</p>
<p>
The solution: Either use direct URL input, or make sure your content's newlines match the architecture your system expects!
</p>
</div>
<h5>
I've got feedback!
</h5>
<div>
Great - hit us up on GitHub.
</div>
</div>
</article>
</main>
<script>
(function() {
setTimeout(function () {
var div = document.getElementById('div-gpt-ad-1464356486655-0');
if(!div) {
// this is dev environment
return;
}
if(div.offsetWidth === 0 || div.offsetHeight === 0) {
//if(div.innerHTML == '') {
var newdiv = document.createElement('div');
newdiv.innerHTML = '<div style="clear: both;width: 100%;height: 10px;display: block;"></div><div class="fourty pad"><div class="ads">this is an AD →</div></div><div class="sixty pad"><a href="http://bit.ly/23cf3tp" class="cta" data-ga="textad" target="_blank"><img src="https://pbs.twimg.com/profile_images/615675308243488768/_d8TRzzL_400x400.png" style="float: left;width: 60px;border: 1px solid #e1e1e1; border-radius: 2px;margin: 0 10px 0 0;"><strong>Backup your code in the cloud!</strong><br>Host unlimited private projects, for free with BitBucket.<div style="clear: both;width: 100%;display: block;"></div></a></div>';
div.parentNode.insertBefore(newdiv, div.nextSibling);
}
}, 1000);
})();
</script>
</body>
</html>