-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
72 lines (67 loc) · 12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<html><head><meta charset="utf-8"><title>Hjson, a user interface for JSON</title><meta name="description" content="Hjson, a user interface for JSON. Adds comments, makes it nicer to read and avoids comma mistakes."><meta name="viewport" content="width=device-width"><link rel="canonical" href="https://hjson.github.io"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="css/md.css"><link rel="stylesheet" type="text/css" href="css/pg5.css"><script type="text/javascript">0<window.location.href.indexOf("hjson.org")&&(window.location.href="https://hjson.github.io")</script><meta name="twitter:card" content="summary" f=""><meta name="twitter:site" content="@laktakk"><meta name="twitter:creator" content="@laktakk"><meta name="twitter:title" content="Hjson, a user interface for JSON"><meta name="twitter:description" content="Hjson, a user interface for JSON. Adds comments, makes it nicer to read and avoids comma mistakes."><meta name="twitter:image" content="https://hjson.github.io/icon/hjson-s.png"><link rel="icon" type="image/png" sizes="192x192" href="fav/icon-192x192.png"><link rel="icon" type="image/png" sizes="32x32" href="fav/icon-32x32.png"><link rel="icon" type="image/png" sizes="96x96" href="fav/icon-96x96.png"><link rel="apple-touch-icon" href="fav/icon-192x192.png"><meta name="msapplication-TileImage" content="fav/icon-192x192.png"></head><body><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script><nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button> <a class="navbar-brand" href="."><img src="icon/hjson-st.png">Hjson</a></div><div class="collapse navbar-collapse" id="navbar-collapse-1"><ul class="nav navbar-nav"><li><a class="btn navbar-btn btn-success" href="users.html">Users</a></li><li><a class="btn navbar-btn btn-success" href="download.html">Developers</a></li><li><a href="syntax.html">Syntax</a></li><li><a class="btn navbar-btn btn-danger" href="try.html">Try</a></li><li><a href="faq.html">FAQ</a></li><li><a aria-label="Star hjson on GitHub" data-count-aria-label="# stargazers on GitHub" data-count-api="/repos/hjson/hjson#stargazers_count" data-count-href="/hjson/hjson/stargazers" data-style="mega" data-icon="octicon-star" href="https://github.com/hjson/hjson" class="github-button">Star</a></li></ul></div></div></nav><div id="main"><div class="content"><h2 id="hjson-a-user-interface-for-json">Hjson, a user interface for JSON</h2><div class="sam"><div><h3 id="status">Status</h3></div><div class="aa"><p>This project is now entirely community-supported. If you would like to help or want to report an issue, please see our <a href="https://github.com/hjson/">GitHub</a>.</p></div><div class="bb"><div class="pkgs col2"><a href="http://www.npmjs.com/package/hjson"><img src="https://img.shields.io/npm/v/hjson.svg?style=flat-square" alt="npm"></a><a href="https://www.nuget.org/packages/Hjson/"><img src="https://img.shields.io/nuget/v/Hjson.svg?style=flat-square" alt="nuget"></a><a href="https://www.nuget.org/packages/HjsonSharp/"><img src="https://img.shields.io/nuget/v/HjsonSharp.svg?style=flat-square" alt="nuget"></a><a href="https://github.com/hjson/hjson-go/releases"><img src="https://img.shields.io/github/release/hjson/hjson-go.svg?style=flat-square&label=go-pkg" alt="go"></a><a href="http://search.maven.org/#search|ga|1|g%3A%22org.hjson%22%20a%3A%22hjson%22"><img src="https://img.shields.io/maven-central/v/org.hjson/hjson.svg?style=flat-square&label=maven" alt="maven"></a><a href="https://packagist.org/packages/laktak/hjson"><img src="https://img.shields.io/packagist/v/laktak/hjson.svg?style=flat-square" alt="packagist"></a><a href="https://pypi.python.org/pypi/hjson"><img src="https://img.shields.io/pypi/v/hjson.svg?style=flat-square" alt="PyPI version"></a><a href="https://github.com/hjson/hjson-cpp/releases"><img src="https://img.shields.io/github/release/hjson/hjson-cpp.svg?style=flat-square&label=c%2b%2b" alt="C++"></a><a href="https://crates.io/crates/serde-hjson"><img src="https://img.shields.io/crates/v/serde-hjson.svg?style=flat-square" alt="crate"></a><a href="https://crates.io/crates/deser-hjson"><img src="https://img.shields.io/crates/v/deser-hjson.svg?style=flat-square" alt="crate"></a><a href="https://rubygems.org/gems/hjson"><img src="https://img.shields.io/gem/v/hjson.svg?style=flat-square" alt="gem"></a><a href="https://luarocks.org/modules/cryi/hjson-lua"><img src="https://img.shields.io/luarocks/v/cryi/hjson-lua?style=flat-square" alt="LuaRocks"></a><a href="https://raku.land/cpan:AKIYM/JSON::Hjson"><img src="https://raku.land/cpan:AKIYM/JSON::Hjson/badges/version" alt="Raku"></a></div><div class="pkgs epkgs"><a href="https://github.com/ajaxorg/ace-builds"><img src="https://img.shields.io/badge/Ace-editor-green.svg?style=flat-square" alt="Ace"></a><a href="https://atom.io/packages/language-hjson"><img src="https://img.shields.io/badge/Atom-editor-green.svg?style=flat-square" alt="Atom"></a><a href="https://github.com/hjson/textmate-hjson"><img src="https://img.shields.io/badge/IntelliJ-editor-green.svg?style=flat-square" alt="IntelliJ"></a><a href="https://github.com/laktak/npp-hjson"><img src="https://img.shields.io/badge/Notepad%2B%2B-editor-green.svg?style=flat-square" alt="Notepad++"></a><a href="https://packagecontrol.io/packages/Hjson"><img src="https://img.shields.io/badge/Sublime%20Text-editor-green.svg?style=flat-square" alt="Sublime Text"></a><a href="https://github.com/hjson/textmate-hjson"><img src="https://img.shields.io/badge/TextMate%20%26%20Co-editor-green.svg?style=flat-square" alt="TextMate & Co"></a><a href="https://github.com/hjson/vim-hjson"><img src="https://img.shields.io/badge/Vim-editor-green.svg?style=flat-square" alt="Vim"></a><a href="https://visualstudiogallery.msdn.microsoft.com/7517a276-112b-4772-b6d8-5a1e6b0eb281"><img src="https://img.shields.io/badge/Visual%20Studio-editor-green.svg?style=flat-square" alt="VisualStudio"></a><a href="https://marketplace.visualstudio.com/items?itemName=laktak.hjson"><img src="https://img.shields.io/badge/VS%20Code-editor-green.svg?style=flat-square" alt="VS Code"></a></div></div><div class="clear"></div><hr><div><h3 id="intro">Intro</h3></div><div class="aa"><p>JSON is easy for humans to read and write... in theory. <em>In practice</em> JSON gives us plenty of opportunities to make mistakes without even realizing it.</p><p>Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. It's intended to be used like a user interface for humans, to read and edit before passing the JSON data to the machine.</p></div><div class="bb"><pre><code>{
# TL;DR
human: Hjson
machine: JSON
}
</code></pre></div><div class="clear"></div></div><h2 id="how-does-hjson-help-">How does Hjson help?</h2><div class="sam"><div><h3 id="commas-">Commas!</h3></div><div class="aa"><p><strong>Never see a syntax error because of a missing or trailing comma again (unless you try really hard)</strong>.</p><p>A good practice is to put each value onto a new line, in this case commas are optional and should be omitted.</p></div><div class="bb"><pre><code>{
first: 1
second: 2
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="comments">Comments</h3></div><div class="aa"><p><strong>You are allowed to use comments! <em>Encouraged, even!</em></strong></p><p>Comments allow you to document your data inline. You can also use them to comment out values when testing.</p></div><div class="bb"><pre><code>{
# hash style comments
# (because it's just one character)
// line style comments
// (because it's like C/JavaScript/...)
/* block style comments because
it allows you to comment out a block */
# Everything you do in comments,
# stays in comments ;-}
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="object-names-keys-">Object Names (Keys)</h3></div><div class="aa"><p><strong>Object names can be specified without quotes.</strong></p><p>This makes them easier to read.</p></div><div class="bb"><pre><code>{
# specify rate in requests/second
rate: 1000
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="quoteless-strings">Quoteless Strings</h3></div><div class="aa"><p><strong>You can specify strings without quotes.</strong></p><p>In this case only one value per line and no commas are allowed.</p></div><div class="bb"><pre><code>{
JSON: "a string"
Hjson: a string
# notice, no escape necessary:
RegEx: \s+
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="multiline">Multiline</h3></div><div class="aa"><p><strong>Write multiline strings with proper whitespace handling.</strong></p><p>A simple syntax and easy to read.</p></div><div class="bb"><pre><code>{
md:
'''
First line.
Second line.
This line is indented by two spaces.
'''
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="punctuators-spaces-and-escapes">Punctuators, Spaces and Escapes</h3></div><div class="aa"><p>JSON and Hjson use the characters <code>{}[],:</code> as punctuators to define the structure of the data.</p><p>Punctuators and whitespace can't be used in an unquoted key or as the first character of a quoteless string. In this (rather uncommon) case you need to use quotes.</p><p>The backslash is only used as an escape character in a quoted string.</p></div><div class="bb"><pre><code>{
"key name": "{ sample }"
"{}": " spaces at the start/end "
this: is OK though: {}[],:
}
</code></pre></div><div class="clear"></div><hr><div><h3 id="hjson">Hjson</h3></div><div class="aa"><p><strong>"So this is Hjson."</strong></p><p>If you like it please go ahead and add a star!</p><p><a aria-label="Star hjson on GitHub" data-count-aria-label="# stargazers on GitHub" data-count-api="/repos/hjson/hjson#stargazers_count" data-count-href="/hjson/hjson/stargazers" data-style="mega" data-icon="octicon-star" href="https://github.com/hjson/hjson" class="github-button">Star</a></p><p>Are you a <a href="users.html">user</a>? Then <strong>ask the <a href="download.html">developer</a> of your favorite application to add Hjson support</strong>!</p><p>Interested in details? <a href="syntax.html">Take a look at the syntax.</a></p><p>Questions? <a href="faq.html">See the FAQ.</a></p></div><div class="bb"><pre><code>{
// use #, // or /**/ comments,
// omit quotes for keys
key: 1
// omit quotes for strings
contains: everything on this line
// omit commas at the end of a line
cool: {
foo: 1
bar: 2
}
// allow trailing commas
list: [
1,
2,
]
// and use multiline strings
realist:
'''
My half empty glass,
I will fill your empty half.
Now you are half full.
'''
}
</code></pre></div><div class="clear"></div></div></div><div class="ynav"><a href="users.html">Users</a> <a href="download.html">Developers</a> <a href="syntax.html">Syntax</a> <a href="try.html">Try</a> <a href="faq.html">FAQ</a> <a href="https://github.com/hjson/hjson/issues">Feedback</a> <a href="history.html">History</a></div></div><script>!function(a,e,t,n,c,o,g){a.GoogleAnalyticsObject=c,a.ga=a.ga||function(){(a.ga.q=a.ga.q||[]).push(arguments)},a.ga.l=1*new Date,o=e.createElement(t),g=e.getElementsByTagName(t)[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",g.parentNode.insertBefore(o,g)}(window,document,"script",0,"ga"),ga("create","UA-49208230-1","auto"),ga("send","pageview"),$(document).on("click",".navbar-collapse.in",function(a){$(a.target).is("a")&&"dropdown-toggle"!=$(a.target).attr("class")&&$(this).collapse("hide")})</script><script async="" defer="" id="github-bjs" src="https://buttons.github.io/buttons.js"></script></body></html>