<commit_before><html><head>
  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="css/md.css">
  <link rel="stylesheet" type="text/css" href="css/pg.css">
  <title>Hjson, the Human JSON</title>
</head>

<body>

<div id="forkongithub"><a href="https://github.com/laktak/hjson">Star on GitHub</a></div>

<div class="content">
<h1 id="hjson-the-human-json">Hjson, the Human JSON</h1>
<p><span class="big">A data format that caters to humans and helps reduce the errors they make.</span></p>
<div class="get"><a class="xbt" href="#download">Get Hjson!</a><a class="xbt xbt2" href="try.html">Try It!</a></div><h2 id="intro">Intro</h2><div class="sam"><div class="aa"><h3 id="comments-yay-">Comments, yay!</h3><h4><strong>"What exactly is this value? A comment would help!"</strong></h4><p>Sure, comments allow you to document your data.</p></div><div class="bb"><pre><code>{
  # specify rate in requests/second
  "rate": 1000
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="quotes">Quotes</h3><h4><strong>"Why do I have to place key names in quotes?"</strong></h4><p>Glad you asked. Actually you don't need to do that. <a href="#syntax" class="ref">(see syntax)</a></p></div><div class="bb"><pre><code>{
  key: "value"
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="more-quotes">More Quotes</h3><h4><strong>"Come to think of it, why do I have to place strings in quotes?"</strong></h4><p>You don't. Quotes for strings are optional as well. <a href="#syntax" class="ref">(with exceptions)</a></p></div><div class="bb"><pre><code>{
  text: look ma, no quotes!
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="escapes">Escapes</h3><h4><strong>"When there are no quotes, do I need escapes?"</strong></h4><p>No, escapes are gone from unquoted strings.</p></div><div class="bb"><pre><code>{
  # write a regex without escaping the escape
  regex: ^\d*\.{0,1}\d+$

  # quotes in the content need no escapes
  inject: &lt;div class="important"&gt;&lt;/div&gt;

  # escapes work inside quotes
  escape: "c:\\windows"
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="commas">Commas</h3><h4><strong>"Now I forgot the comma at the end."</strong></h4><p>So you did. But lucky for you, in Hjson they are optional.</p></div><div class="bb"><pre><code>{
  one: 1
  two: 2
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="more-commas">More Commas</h3><h4><strong>"So what if I added a trailing comma?"</strong></h4><p>Can't make up or mind or was that copy &amp; paste?</p><p>Hjson totally respects your choice of trailing commas. Actually, it ignores them.</p></div><div class="bb"><pre><code>{
  one: 1,
  two: 2,
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="multiline">Multiline</h3><h4><strong>"Multiline strings are kind of hard to read."</strong></h4><p><code>"I wonder\nwhy you\nsay that."</code> Hjson will let you write them with proper whitespace handling.</p></div><div class="bb"><pre><code>{
  haiku:
    '''
    JSON I love you.
    But strangled is my data.
    This, so much better.
    '''
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="round-trip">Round trip</h3><h4><strong>"Can Hjson keep my comments when updating a config file?"</strong></h4><p>Yes, Hjson allows you to round-trip your data, including your comments.</p></div><div class="bb"><pre><code>var data = Hjson.parse(text, { keepWsc: true });

// use data like a normal object
data.foo = "text";

// stringify with comments
text = Hjson.stringify(data, { keepWsc: true });
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="json">JSON</h3><h4><strong>"But maybe I want to use JSON here."</strong></h4><p>Feel free to use JSON anywhere you like.</p></div><div class="bb"><pre><code>{
  # Arrays are sometimes easier to read
  # when written on a single line.
  favNumbers: [ 1, 2, 3, 6, 42 ]
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="finally">Finally</h3><h4><strong>"So where can I use it?"</strong></h4><p>You should use it whenever data will be edited or looked at by an actual person.</p><p>The best example are configuration files. It also makes debug data dumps easier to read.</p></div><div class="bb"><pre><code>{
  # npm config
  name: hjson
  description: JSON like data format
  main: ./lib/hjson.js
  version: 1.0.1
  tags:
  [
    json
    hjson
  ]
}
</code></pre></div><div class="clear"></div></div>
































<h2 id="syntax">Syntax</h2>
<p>The Hjson syntax is a superset of JSON (<a href="http://json.org/">see json.org</a>) but allows you to</p>
<ul>
<li>omit <code>,</code> at the end of a line,</li>
<li>omit <code>""</code> for keys that contain only <code>letters</code> and <code>digits</code>,</li>
<li>omit <code>""</code> for strings values that<ul>
<li>do not start with a <code>digit</code>, <code>-</code>, <code>{</code>, <code>[</code> or <code>#</code>,</li>
<li>do not start with the keywords <code>true</code>, <code>false</code> or <code>null</code> and</li>
<li>do not use escapes<br>(The string terminates at the newline.)</li>
</ul>
</li>
<li>add <code># comments</code>  (the parser treats comments like whitespace),</li>
<li>use multiline strings with proper whitespace handling:<ul>
<li>starts with triple quotes <code>'''</code>, whitespace on the first line is ignored</li>
<li><code>'''</code> defines the head, on the following lines all whitespace up to this column is ignored</li>
<li>all other whitespace is assumed to be part of the string.</li>
<li>ends with triple quotes <code>'''</code>.</li>
</ul>
</li>
</ul>
<h2 id="download">Download</h2>
<ul>
<li><a href="https://github.com/GlenDC/hjson-c">C, C++</a> (in dev.)</li>
<li><a href="https://github.com/laktak/hjson-cs">C#, .Net</a></li>
<li>Go (in dev.)</li>
<li><a href="https://github.com/laktak/hjson-js">JavaScript</a> (Node.js &amp; Browser)</li>
</ul>
<h2 id="tools">Tools</h2>
<ul>
<li><a href="https://www.npmjs.org/package/hjson">Conversion Tool/CLI</a> (multi-platform)</li>
<li><a href="https://github.com/laktak/gulp-hjson">Gulp Task</a></li>
</ul>

</div>

<div class="footer">
  <a href="https://github.com/laktak/hjson/issues">Feedback &amp; Issues</a> | <a href="https://github.com/laktak">Contact</a>
</div>



<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-49208230-1', 'laktak.github.io');
  ga('send', 'pageview');

</script>


</body><script class="jsdom" src="node_modules/jquery/dist/jquery.js"></script><script class="jsdom" src="dom.js"></script></html><commit_msg>chg links, add sublime<commit_after><html><head>
  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="css/md.css">
  <link rel="stylesheet" type="text/css" href="css/pg.css">
  <title>Hjson, the Human JSON</title>
</head>

<body>

<div id="forkongithub"><a href="https://github.com/laktak/hjson">Star on GitHub</a></div>

<div class="content">
<h1 id="hjson-the-human-json">Hjson, the Human JSON</h1>
<p><span class="big">A data format that caters to humans and helps reduce the errors they make.</span></p>
<div class="get"><a class="xbt" href="#download">Get Hjson!</a><a class="xbt xbt2" href="try.html">Try It!</a></div><h2 id="intro">Intro</h2><div class="sam"><div class="aa"><h3 id="comments-yay-">Comments, yay!</h3><h4><strong>"What exactly is this value? A comment would help!"</strong></h4><p>Sure, comments allow you to document your data.</p></div><div class="bb"><pre><code>{
  # specify rate in requests/second
  "rate": 1000
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="quotes">Quotes</h3><h4><strong>"Why do I have to place key names in quotes?"</strong></h4><p>Glad you asked. Actually you don't need to do that. <a href="#syntax" class="ref">(see syntax)</a></p></div><div class="bb"><pre><code>{
  key: "value"
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="more-quotes">More Quotes</h3><h4><strong>"Come to think of it, why do I have to place strings in quotes?"</strong></h4><p>You don't. Quotes for strings are optional as well. <a href="#syntax" class="ref">(with exceptions)</a></p></div><div class="bb"><pre><code>{
  text: look ma, no quotes!
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="escapes">Escapes</h3><h4><strong>"When there are no quotes, do I need escapes?"</strong></h4><p>No, escapes are gone from unquoted strings.</p></div><div class="bb"><pre><code>{
  # write a regex without escaping the escape
  regex: ^\d*\.{0,1}\d+$

  # quotes in the content need no escapes
  inject: &lt;div class="important"&gt;&lt;/div&gt;

  # escapes work inside quotes
  escape: "c:\\windows"
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="commas">Commas</h3><h4><strong>"Now I forgot the comma at the end."</strong></h4><p>So you did. But lucky for you, in Hjson they are optional.</p></div><div class="bb"><pre><code>{
  one: 1
  two: 2
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="more-commas">More Commas</h3><h4><strong>"So what if I added a trailing comma?"</strong></h4><p>Can't make up or mind or was that copy &amp; paste?</p><p>Hjson totally respects your choice of trailing commas. Actually, it ignores them.</p></div><div class="bb"><pre><code>{
  one: 1,
  two: 2,
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="multiline">Multiline</h3><h4><strong>"Multiline strings are kind of hard to read."</strong></h4><p><code>"I wonder\nwhy you\nsay that."</code> Hjson will let you write them with proper whitespace handling.</p></div><div class="bb"><pre><code>{
  haiku:
    '''
    JSON I love you.
    But strangled is my data.
    This, so much better.
    '''
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="round-trip">Round trip</h3><h4><strong>"Can Hjson keep my comments when updating a config file?"</strong></h4><p>Yes, Hjson allows you to round-trip your data, including your comments.</p></div><div class="bb"><pre><code>var data = Hjson.parse(text, { keepWsc: true });

// use data like a normal object
data.foo = "text";

// stringify with comments
text = Hjson.stringify(data, { keepWsc: true });
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="json">JSON</h3><h4><strong>"But maybe I want to use JSON here."</strong></h4><p>Feel free to use JSON anywhere you like.</p></div><div class="bb"><pre><code>{
  # Arrays are sometimes easier to read
  # when written on a single line.
  favNumbers: [ 1, 2, 3, 6, 42 ]
}
</code></pre></div><div class="clear"></div><hr><div class="aa"><h3 id="finally">Finally</h3><h4><strong>"So where can I use it?"</strong></h4><p>You should use it whenever data will be edited or looked at by an actual person.</p><p>The best example are configuration files. It also makes debug data dumps easier to read.</p></div><div class="bb"><pre><code>{
  # npm config
  name: hjson
  description: JSON like data format
  main: ./lib/hjson.js
  version: 1.0.1
  tags:
  [
    json
    hjson
  ]
}
</code></pre></div><div class="clear"></div></div>
































<h2 id="syntax">Syntax</h2>
<p>The Hjson syntax is a superset of JSON (<a href="http://json.org/">see json.org</a>) but allows you to</p>
<ul>
<li>omit <code>,</code> at the end of a line,</li>
<li>omit <code>""</code> for keys that contain only <code>letters</code> and <code>digits</code>,</li>
<li>omit <code>""</code> for strings values that<ul>
<li>do not start with a <code>digit</code>, <code>-</code>, <code>{</code>, <code>[</code> or <code>#</code>,</li>
<li>do not start with the keywords <code>true</code>, <code>false</code> or <code>null</code> and</li>
<li>do not use escapes<br>(The string terminates at the newline.)</li>
</ul>
</li>
<li>add <code># comments</code>  (the parser treats comments like whitespace),</li>
<li>use multiline strings with proper whitespace handling:<ul>
<li>starts with triple quotes <code>'''</code>, whitespace on the first line is ignored</li>
<li><code>'''</code> defines the head, on the following lines all whitespace up to this column is ignored</li>
<li>all other whitespace is assumed to be part of the string.</li>
<li>ends with triple quotes <code>'''</code>.</li>
</ul>
</li>
</ul>
<h2 id="download">Download</h2>
<ul>
<li><a href="https://github.com/laktak/hjson-js">JavaScript</a> (Node.js &amp; Browser)</li>
<li><a href="https://github.com/laktak/hjson-cs">C#, .Net</a></li>
<li>Under devlopment:<ul>
<li><a href="https://github.com/GlenDC/hjson-c">C, C++</a></li>
</ul>
</li>
</ul>
<h2 id="tools">Tools</h2>
<ul>
<li><a href="https://www.npmjs.org/package/hjson">Conversion Tool/CLI</a> (multi-platform)</li>
<li><a href="https://github.com/laktak/gulp-hjson">Gulp Task</a></li>
</ul>
<h2 id="editor-syntax">Editor Syntax</h2>
<ul>
<li><a href="https://github.com/laktak/sublime-hjson">Sublime Text</a> (<code>Hjson</code> in Package Control)</li>
</ul>

</div>

<div class="footer">
  <a href="https://github.com/laktak/hjson/issues">Feedback &amp; Issues</a> | <a href="https://github.com/laktak">Contact</a>
</div>



<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-49208230-1', 'laktak.github.io');
  ga('send', 'pageview');

</script>


</body><script class="jsdom" src="node_modules/jquery/dist/jquery.js"></script><script class="jsdom" src="dom.js"></script></html>
{'fraction_non_alphanumeric': 0.2266514806378132, 'fraction_numerical': 0.011958997722095672, 'mean_word_length': 5.167251975417033, 'pattern_counts': {'":': 2, '<': 705, '<?xml version=': 0, '>': 705, 'https://': 17, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6379857', 'n_tokens_mistral': 5128, 'n_tokens_neox': 4976, 'n_words': 1267}