You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jsoncstyleguide.xml
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ This style guide contains many details that are initially hidden from view. The
21
21
</STYLEPOINT>
22
22
</CATEGORY>
23
23
<CATEGORYtitle="Introduction">
24
-
<p>This style guide documents guidelines and recommendations for building JSON APIs at Google. In general, JSON APIs should follow the spec found at <ahref="http://www.json.org">JSON.org</a>. This style guide clarifies and standardizes specific cases so that JSON APIs from Google have a standard look and feel. These guidelines are applicable to JSON requests and responses in both RPC-based and REST-based APIs.</p>
24
+
<p>This style guide documents guidelines and recommendations for building JSON APIs at Google. In general, JSON APIs should follow the spec found at <ahref="https://www.json.org">JSON.org</a>. This style guide clarifies and standardizes specific cases so that JSON APIs from Google have a standard look and feel. These guidelines are applicable to JSON requests and responses in both RPC-based and REST-based APIs.</p>
25
25
</CATEGORY>
26
26
<CATEGORYtitle="Definitions">
27
27
<p>For the purposes of this style guide, we define the following terms:</p><ul><li><b>property</b> - a name/value pair inside a JSON object.</li><li><b>property name</b> - the name (or key) portion of the property.</li><li><b>property value</b> - the value portion of the property.</li></ul>
@@ -129,8 +129,8 @@ JSON maps can use any Unicode character in key names.
129
129
// The "thumbnails" property is a map that maps
130
130
// a pixel size to the thumbnail url of that size.
131
131
"thumbnails": {
132
-
"72": "http://url.to.72px.thumbnail",
133
-
"144": "http://url.to.144px.thumbnail"
132
+
"72": "https://url.to.72px.thumbnail",
133
+
"144": "https://url.to.144px.thumbnail"
134
134
}
135
135
}
136
136
@@ -212,10 +212,10 @@ Avoid naming conflicts by choosing a new property name or versioning the API.
212
212
<CATEGORYtitle="Property Value Guidelines">
213
213
<STYLEPOINTtitle="Property Value Format">
214
214
<SUMMARY>
215
-
Property values must be Unicode booleans, numbers, strings, objects, arrays, or <code>null</code>.
215
+
Property values must be booleans, numbers, Unicode strings, objects, arrays, or <code>null</code>.
216
216
</SUMMARY>
217
217
<BODY>
218
-
<p>The spec at <ahref="http://www.json.org">JSON.org</a> specifies exactly what type of data is allowed in a property value. This includes Unicode booleans, numbers, strings, objects, arrays, and <code>null</code>. JavaScript expressions are not allowed. APIs should support that spec for all values, and should choose the data type most appropriate for a particular property (numbers to represent numbers, etc.).</p><p>Good:</p>
218
+
<p>The spec at <ahref="https://www.json.org">JSON.org</a> specifies exactly what type of data is allowed in a property value. This includes booleans, numbers, Unicode strings, objects, arrays, and <code>null</code>. JavaScript expressions are not allowed. APIs should support that spec for all values, and should choose the data type most appropriate for a particular property (numbers to represent numbers, etc.).</p><p>Good:</p>
219
219
<CODE_SNIPPET>
220
220
{
221
221
"canPigsFly": null, // null
@@ -334,7 +334,7 @@ Latitudes/Longitudes should be formatted as recommended by ISO 6709.
334
334
</STYLEPOINT>
335
335
</CATEGORY>
336
336
<CATEGORYtitle="JSON Structure & Reserved Property Names">
337
-
<p>In order to maintain a consistent interface across APIs, JSON objects should follow the structure outlined below. This structure applies to both requests and responses made with JSON. Within this structure, there are certain property names that are reserved for specific uses. These properties are NOT required; in other words, each reserved property may appear zero or one times. But if a service needs these properties, this naming convention is recommend. Here is a schema of the JSON structure, represented in <ahref="https://www.google.com/url?sa=D&q=http%3A%2F%2Forderly-json.org%2F">Orderly</a> format (which in turn can be compiled into a <ahref="https://www.google.com/url?sa=D&q=http%3A%2F%2Fjson-schema.org%2F">JSONSchema</a>). You can few examples of the JSON structure at the end of this guide.</p>
337
+
<p>In order to maintain a consistent interface across APIs, JSON objects should follow the structure outlined below. This structure applies to both requests and responses made with JSON. Within this structure, there are certain property names that are reserved for specific uses. These properties are NOT required; in other words, each reserved property may appear zero or one times. But if a service needs these properties, this naming convention is recommended. Here is a schema of the JSON structure, represented in <ahref="https://www.google.com/url?sa=D&q=http%3A%2F%2Forderly-json.org%2F">Orderly</a> format (which in turn can be compiled into a <ahref="https://www.google.com/url?sa=D&q=http%3A%2F%2Fjson-schema.org%2F">JSONSchema</a>). You can few examples of the JSON structure at the end of this guide.</p>
338
338
<CODE_SNIPPET>
339
339
object {
340
340
string apiVersion?;
@@ -661,7 +661,7 @@ Property Value Type: array<br />Parent: <code>data</code>
661
661
</STYLEPOINT>
662
662
</CATEGORY>
663
663
<CATEGORYtitle="Reserved Property Names for Paging">
664
-
<p>The following properties are located in the <code>data</code> object, and help page through a list of items. Some of the language and concepts are borrowed from the <a href="http://www.opensearch.org/Home">OpenSearch specification</a>.</p><p>The paging properties below allow for various styles of paging, including:</p><ul><li>Previous/Next paging - Allows user's to move forward and backward through a list, one page at a time. The <code>nextLink</code> and <code>previousLink</code> properties (described in the "Reserved Property Names for Links" section below) are used for this style of paging.</li><li>Index-based paging - Allows user's to jump directly to a specific item position within a list of items. For example, to load 10 items starting at item 200, the developer may point the user to a url with the query string <code>?startIndex=200</code>.</li><li>Page-based paging - Allows user's to jump directly to a specific page within the items. This is similar to index-based paging, but saves the developer the extra step of having to calculate the item index for a new page of items. For example, rather than jump to item number 200, the developer could jump to page 20. The urls during page-based paging could use the query string <code>?page=1</code> or <code>?page=20</code>. The <code>pageIndex</code> and <code>totalPages</code> properties are used for this style of paging.</li></ul><p>An example of how to use these properties to implement paging can be found at the end of this guide.</p>
664
+
<p>The following properties are located in the <code>data</code> object, and help page through a list of items. Some of the language and concepts are borrowed from the <a href="https://www.opensearch.org/">OpenSearch specification</a>.</p><p>The paging properties below allow for various styles of paging, including:</p><ul><li>Previous/Next paging - Allows user's to move forward and backward through a list, one page at a time. The <code>nextLink</code> and <code>previousLink</code> properties (described in the "Reserved Property Names for Links" section below) are used for this style of paging.</li><li>Index-based paging - Allows user's to jump directly to a specific item position within a list of items. For example, to load 10 items starting at item 200, the developer may point the user to a url with the query string <code>?startIndex=200</code>.</li><li>Page-based paging - Allows user's to jump directly to a specific page within the items. This is similar to index-based paging, but saves the developer the extra step of having to calculate the item index for a new page of items. For example, rather than jump to item number 200, the developer could jump to page 20. The urls during page-based paging could use the query string <code>?page=1</code> or <code>?page=20</code>. The <code>pageIndex</code> and <code>totalPages</code> properties are used for this style of paging.</li></ul><p>An example of how to use these properties to implement paging can be found at the end of this guide.</p>
665
665
<STYLEPOINTtitle="data.currentItemCount">
666
666
<SUMMARY>
667
667
Property Value Type: integer<br />Parent: <code>data</code>
@@ -935,7 +935,7 @@ Property Value Type: string<br />Parent: <code>error.errors</code>
935
935
<CODE_SNIPPET>
936
936
{
937
937
"error":{
938
-
"code": 404
938
+
"code": 404,
939
939
"message": "File Not Found",
940
940
"errors": [{"message": "File Not Found"}]
941
941
}
@@ -985,7 +985,7 @@ Property Value Type: string<br />Parent: <code>error.errors</code>
0 commit comments