-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
235 lines (177 loc) · 10.3 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="favicon.ico">
<title>JSON Schema</title>
<link href="./css/bootstrap-custom.min.css" rel="stylesheet">
<link href="./css/font-awesome-4.0.3.css" rel="stylesheet">
<link rel="stylesheet" href="./css/highlight.css">
<link href="./css/base.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Main title -->
<a class="navbar-brand" href=".">JSON Schema</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li class="active">
<a href=".">Home</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Building Schemas <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="spec/introduction/">Introduction</a>
</li>
<li >
<a href="spec/basic_types/">Basic Types</a>
</li>
<li >
<a href="spec/arrays/">Arrays</a>
</li>
<li >
<a href="spec/objects/">Objects</a>
</li>
<li >
<a href="spec/generic_keywords/">Generic Keywords</a>
</li>
<li >
<a href="spec/multiple_types/">Multiple Types</a>
</li>
<li >
<a href="spec/definitions_references/">Definitions & References</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Formal Specification <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="spec/why/">Why a formal specification?</a>
</li>
<li >
<a href="spec/grammar/">Syntax</a>
</li>
<li >
<a href="spec/semantics/">Semantics</a>
</li>
<li >
<a href="spec/Differences_with_the_standard/">About this grammar</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Validator <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="spec/validator/">Check our Validator</a>
</li>
</ul>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
<li class="disabled">
<a rel="next" >
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="prev" href="spec/introduction/">
Next <i class="fa fa-arrow-right"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="main active"><a href="#about-this-site">About this site</a></li>
<li class="main "><a href="#what-is-json">What is JSON?</a></li>
<li class="main "><a href="#what-is-json-schema">What is JSON Schema?</a></li>
<li class="main "><a href="#why-to-use-json-schema">Why to use JSON Schema</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<p><CENTER><h1> HOME</h1></CENTER>
<CENTER>Here you'll find some general information about the site JSON Schema</CENTER></p>
<h2 id="about-this-site">About this site</h2>
<p>This site is intended to be a complete and understandable guide to <a href="http://json-schema.org">JSON Schema</a>. You can find an exhaustive specification with intuitive examples. The people behind this project form part of the <a href="http://dcc.ing.puc.cl">Computer Science Department</a> at <a href="http://www.uc.cl/en">PUC Chile</a>, and belong to the <a href="http://ciws.cl">Center for Semantic Web Research</a>.</p>
<hr />
<h2 id="what-is-json">What is JSON?</h2>
<p><a href="http://json.org">JSON</a> (JavaScript Object Notation) is a file format commonly used for sharing information over the Web. JSON files are lightweight and easy to read both by machines and developers. This has made JSON the most popular file format for client-server communication. The next example JSON file contains information about the famous Chilean football player Alexis Sanchez.</p>
<p><strong>alexis_sanchez.json</strong></p>
<pre><code>{
"first_name": "Alexis",
"last_name": "Sanchez",
"age": 27,
"club": {
"name": "Arsenal FC",
"founded": 1886
}
}</code></pre>
<hr />
<h2 id="what-is-json-schema">What is JSON Schema?</h2>
<p>A JSON Schema is a file that specifies the structure of JSON documents used by a certain application. For example, when sharing information about football players, one would like to ensure that a JSON document corresponding to a player has a given structure. A JSON Schema is a JSON document in which some words (keywords) have a predefined meaning. The next example schema specifies documents like <strong>alexis_sanchez.json</strong>.</p>
<p><strong>player_schema.json</strong>
<pre><code>{
"type": "object",
"properties": {
"first_name": { "type": "string" },
"last_name": { "type": "string" },
"age": { "type": "integer" },
"club": {
"type": "object",
"properties": {
"name": { "type": "string" },
"founded": { "type": "integer" }
},
"required": ["name"]
}
},
"required": ["first_name", "last_name", "age", "club"]
}</code></pre></p>
<hr />
<p>Intuitively, using this schema we are saying that our JSON documents have to have a property <strong>"first_name"</strong> with a string value, a property <strong>"last_name"</strong> and so on. Additionally, we also require that some of the information, like <strong>"first_name", "last_name", "age"</strong> and <strong>"club"</strong> details are present in each document conforming to the schema, while other properties may be ommited.</p>
<h2 id="why-to-use-json-schema">Why to use JSON Schema</h2>
<p>There are several reasons to use a schema when storing data or sharing data over the Web. Some of the benefits:</p>
<ul>
<li><em>Filtering content:</em> When storing files or receiving files over the web, programmers always want to ensure the data comes in the right format. JSON Schema allows for on-the-fly validation of JSON files.</li>
<li><em>Compression:</em> If a schema is known by both the source and the target when sharing information, the network load can be decreased by compressing property names.</li>
<li><em>Standardization:</em> Today many APIs receive JSON files as instructions. For example, you can send a JSON file to Twitter's API indicating you want the last five tweets of a user. To use one of these APIs, you need to read the documentation provided by the API developers. Sometimes this documentation is messy and hard to read. If APIs defined a JSON Schema for input files, one could easily understand the allowed JSON files. Moreover, this allows for creating automation tools. For example, given a JSON Schema one could automatically generate a set of example API calls.</li>
</ul></div>
</div>
<footer class="col-md-12">
<hr>
<center>© Copyright 2015-2016, Fernando Suárez, Juan Reutter, Domagoj Vrgoc, Martín Ugarte, Felipe Pezoa, <a href="http://www.ciws.cl/">CSWR</a>.<br> Last updated on August 17, 2016.</center>
<center>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</center>
</footer>
<script src="./js/jquery-1.10.2.min.js"></script>
<script src="./js/bootstrap-3.0.3.min.js"></script>
<script src="./js/highlight.pack.js"></script>
<script src="./js/base.js"></script>
</body>
</html>