Skip to content

Commit bda8566

Browse files
authored
docs: format JSON code blocks as jsonc (parse-community#883)
1 parent 86d16c0 commit bda8566

37 files changed

+246
-180
lines changed

_includes/android/objects.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ gameScore.saveInBackground();
2828

2929
After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this:
3030

31-
```javascript
32-
objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false,
33-
createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z"
31+
```jsonc
32+
{
33+
"objectId": "xWMyZ4YEGZ",
34+
"score": 1337,
35+
"playerName": "Sean Plott",
36+
"cheatMode": false,
37+
"createdAt":"2022-01-01T12:23:45.678Z",
38+
"updatedAt":"2022-01-01T12:23:45.678Z"
39+
}
3440
```
3541

3642
There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it.

_includes/arduino/objects.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ response.close(); // Free the resource
3535

3636
After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this:
3737

38-
```javascript
39-
objectId: "xWMyZ4YEGZ", temperature: 175.0, leverDown: true, createdAt: "2022-01-01T12:23:45.678Z", updatedAt: "2022-01-01T12:23:45.678Z"
38+
```jsonc
39+
{
40+
"objectId": "xWMyZ4YEGZ",
41+
"score": 1337,
42+
"playerName": "Sean Plott",
43+
"cheatMode": false,
44+
"createdAt":"2022-01-01T12:23:45.678Z",
45+
"updatedAt":"2022-01-01T12:23:45.678Z"
46+
}
4047
```
4148

4249
There are two things to note here. You didn't have to configure or set up a new Class called `Temperature` before running this code. Your Parse app lazily creates this Class for you when it first encounters it.

_includes/cloudcode/cloud-code-advanced.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ end
206206

207207
Here's an example of the JSON data that would be sent in the request to this webhook:
208208

209-
```json
209+
```jsonc
210210
// Sent to webhook
211211
{
212212
"master": false,
@@ -225,14 +225,14 @@ Here's an example of the JSON data that would be sent in the request to this web
225225

226226
This response would indicate a success in the webhook:
227227

228-
```json
228+
```jsonc
229229
// Returned from the webhook on success
230230
{ "success": "Hello World!" }
231231
```
232232

233233
This response would indicate an error in the webhook:
234234

235-
```json
235+
```jsonc
236236
// Returned from the webhook on error
237237
{ "error": "Error message >:(" }
238238
```
@@ -275,7 +275,7 @@ end
275275

276276
Here's an example of the JSON data that would be sent in the request to this webhook:
277277

278-
```json
278+
```jsonc
279279
// Sent to webhook
280280
{
281281
"master": true,
@@ -287,7 +287,7 @@ Here's an example of the JSON data that would be sent in the request to this web
287287

288288
This response would indicate a success in the webhook:
289289

290-
```json
290+
```jsonc
291291
// Returned from the webhook on success
292292
{ "success": "User billed!" }
293293
```
@@ -310,7 +310,7 @@ For triggers, the following parameters are sent to your webhook.
310310

311311
To respond to a `beforeSave` request, send a JSON object with the key `error` or `success` set. This is the same as for Cloud functions, but there's an extra capability with `beforeSave` triggers. By returning an error, you will cancel the save request and the object will not be stored on Parse. You can also return a JSON object in this following format to override the values that will be saved for the object:
312312

313-
```json
313+
```jsonc
314314
{
315315
"className": "AwesomeClass",
316316
"existingColumn": "sneakyChange",
@@ -348,7 +348,7 @@ end
348348

349349
Here's an example of the JSON data that would be sent in the request to this webhook:
350350

351-
```json
351+
```jsonc
352352
// Sent to webhook
353353
{
354354
"master": false,
@@ -419,7 +419,7 @@ end
419419

420420
Here's an example of the JSON data that would be sent in the request to this webhook:
421421

422-
```json
422+
```jsonc
423423
// Sent to webhook
424424
{
425425
"master": false,
@@ -485,7 +485,7 @@ end
485485

486486
Here's an example of the JSON data that would be sent in the request to this webhook:
487487

488-
```json
488+
```jsonc
489489
// Sent to webhook
490490
{
491491
"master": false,
@@ -509,7 +509,7 @@ Here's an example of the JSON data that would be sent in the request to this web
509509

510510
This response would indicate a success in the webhook:
511511

512-
```json
512+
```jsonc
513513
// Returned from the webhook on success
514514
{ "success": true }
515515
```
@@ -554,7 +554,7 @@ end
554554

555555
Here's an example of the JSON data that would be sent in the request to this webhook:
556556

557-
```json
557+
```jsonc
558558
// Sent to webhook
559559
{
560560
"master": false,

_includes/cloudcode/cloud-code.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Let's look at a slightly more complex example where Cloud Code is useful. One reason to do computation in the cloud is so that you don't have to send a huge list of objects down to a device if you only want a little bit of information. For example, let's say you're writing an app that lets people review movies. A single `Review` object could look like:
44

5-
```json
5+
```jsonc
66
{
77
"movie": "The Matrix",
88
"stars": 5,
@@ -112,13 +112,13 @@ In general, two arguments will be passed into cloud functions:
112112

113113
If the function is successful, the response in the client looks like:
114114

115-
```json
115+
```jsonc
116116
{ "result": 4.8 }
117117
```
118118

119119
If there is an error, the response in the client looks like:
120120

121-
```json
121+
```jsonc
122122
{
123123
"code": 141,
124124
"error": "movie lookup failed"

_includes/common/data.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You may import data into your Parse app by using CSV or JSON files. To create a
3636

3737
The JSON format is an array of objects in our REST format or a JSON object with a `results` that contains an array of objects. It must adhere to the [JSON standard](http://json.org/). A file containing regular objects could look like:
3838

39-
```js
39+
```jsonc
4040
{ "results": [
4141
{
4242
"score": 1337,
@@ -63,7 +63,7 @@ In addition to the exposed fields, objects in the Parse User class can also have
6363

6464
A file containing a `User` object could look like:
6565

66-
```js
66+
```jsonc
6767
{ "results":
6868
[{
6969
"username": "cooldude",

_includes/common/security.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ All this is just the beginning. Applications can enforce all sorts of complex ac
389389

390390
For the curious, here's the format for an ACL that restricts read and write permissions to the owner (whose `objectId` is identified by `"aSaMpLeUsErId"`) and enables other users to read the object:
391391

392-
```json
392+
```jsonc
393393
{
394394
"*": { "read":true },
395395
"aSaMpLeUsErId": { "read" :true, "write": true }
@@ -398,7 +398,7 @@ For the curious, here's the format for an ACL that restricts read and write perm
398398

399399
And here's another example of the format of an ACL that uses a Role:
400400

401-
```json
401+
```jsonc
402402
{
403403
"role:RoleName": { "read": true },
404404
"aSaMpLeUsErId": { "read": true, "write": true }
@@ -413,7 +413,7 @@ Given that objects often already have pointers to the user(s) that should have p
413413

414414
Pointer permissions are like virtual ACLs. They don't appear in the ACL column, but if you are familiar with how ACLs work, you can think of them like ACLs. In the above example with the `sender` and `receiver`, each object will act as if it has an ACL of:
415415

416-
```json
416+
```jsonc
417417
{
418418
"<SENDER_USER_ID>": {
419419
"read": true,

_includes/dotnet/objects.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ await gameScore.SaveAsync();
2828

2929
After this code runs, you will probably be wondering if anything really happened. To make sure the data was saved, you can look at the Data Browser in your app on Parse. You should see something like this:
3030

31-
```javascript
32-
objectId: "xWMyZ4YEGZ", score: 1337, playerName: "Sean Plott", cheatMode: false,
33-
createdAt:"2022-01-01T12:23:45.678Z", updatedAt:"2022-01-01T12:23:45.678Z"
31+
```jsonc
32+
{
33+
"objectId": "xWMyZ4YEGZ",
34+
"score": 1337,
35+
"playerName": "Sean Plott",
36+
"cheatMode": false,
37+
"createdAt":"2022-01-01T12:23:45.678Z",
38+
"updatedAt":"2022-01-01T12:23:45.678Z"
39+
}
3440
```
3541

3642
There are two things to note here. You didn't have to configure or set up a new Class called `GameScore` before running this code. Your Parse app lazily creates this Class for you when it first encounters it.

_includes/graphql/classes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Classes
22

33
Since your application does not have a schema yet, you can use the `createClass` mutation to create your first class through the GraphQL API. Run the following:
4-
```js
4+
```jsonc
55
// Header
66
{
77
"X-Parse-Application-Id": "APPLICATION_ID",
@@ -34,7 +34,7 @@ mutation createGameScoreClass {
3434
}
3535
}
3636
```
37-
```js
37+
```jsonc
3838
// Response
3939
{
4040
"data": {

_includes/graphql/customisation.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ By default, all of your Parse classes, including the defaults such as `Parse.Use
109109

110110
In the following example, we limit our GraphQL schema to only expose the default `_User` class, along with a few custom classes:
111111

112-
```javascript
112+
```jsonc
113113
{
114114
"enabledForClasses": ["_User", "Book", "Review", "Comment"],
115115
"disabledForClasses": null
@@ -133,7 +133,7 @@ By default, we enrich the schema by generating a number of [Input Types](https:/
133133

134134
In the following example, we have a custom class called `Review` where the fields `rating` and `body` are allowed on the `create` mutation, and the field `numberOfLikes` on the `update` mutation:
135135

136-
```javascript
136+
```jsonc
137137
{
138138
"classConfigs": [
139139
{
@@ -151,7 +151,7 @@ In the following example, we have a custom class called `Review` where the field
151151

152152
You may decide to restrict which fields can be resolved when getting or finding records from a given class, for example, if you have a class called `Video` which includes a sensitive field `dmcaFlags`, you can hide this field by explicitly stating the fields that can be resolved:
153153

154-
```javascript
154+
```jsonc
155155
{
156156
"classConfigs": [
157157
{
@@ -169,7 +169,7 @@ In production-grade environments where performance optimisation is critical, com
169169

170170
In the following example, we set the fields `name` and `age` as the only two that can be used to filter the `_User` class, and defining the `createdAt` and `age` fields the only sortable field whilst disabling the ascending direction on the `createdAt` field:
171171

172-
```javascript
172+
```jsonc
173173
{
174174
"classConfigs": [
175175
{
@@ -199,7 +199,7 @@ In the following example, we set the fields `name` and `age` as the only two tha
199199
By default, the schema exposes a `get` and `find` operation for each class, for example, `get_User` and `find_User`. You can disable either of these for any class in your schema, like so:
200200

201201

202-
```javascript
202+
```jsonc
203203
{
204204
"classConfigs": [
205205
{
@@ -222,7 +222,7 @@ By default, the schema exposes a `get` and `find` operation for each class, for
222222

223223
By default, generated query names use pluralized version of `className`. You can override this behaviour with `getAlias`/`findAlias`. This is useful when your collection is named in plural or when singular/plural forms are same e.g. `Data`:
224224

225-
```javascript
225+
```jsonc
226226
{
227227
"classConfigs": [
228228
{
@@ -246,7 +246,7 @@ By default, generated query names use pluralized version of `className`. You can
246246
By default, the schema exposes a `create`, `update` and `delete` operation for each class, for example, `create_User`, `update_User` and `delete_User`. You can disable any of these mutations for any class in your schema, like so:
247247

248248

249-
```javascript
249+
```jsonc
250250
{
251251
"classConfigs": [
252252
{
@@ -273,7 +273,7 @@ By default, the schema exposes a `create`, `update` and `delete` operation for e
273273

274274
You can optionally override the default generated mutation names with aliases:
275275

276-
```javascript
276+
```jsonc
277277
{
278278
"classConfigs": [
279279
{
@@ -326,7 +326,7 @@ extend type Query {
326326
Parse.Cloud.define("hello", () => "Hello, world!");
327327
```
328328

329-
```js
329+
```jsonc
330330
// Header
331331
{
332332
"X-Parse-Application-Id": "APPLICATION_ID",
@@ -342,7 +342,7 @@ query hello {
342342

343343
The code above should resolve to this:
344344

345-
```js
345+
```jsonc
346346
// Response
347347
{
348348
"data": {
@@ -418,7 +418,7 @@ Parse.Cloud.define("addToCart", async (req) => {
418418
});
419419
```
420420

421-
```js
421+
```jsonc
422422
// Header
423423
{
424424
"X-Parse-Application-Id": "APPLICATION_ID",
@@ -437,7 +437,7 @@ mutation addItemToCart {
437437

438438
The code above should resolve to something similar to this:
439439

440-
```js
440+
```jsonc
441441
// Response
442442
{
443443
"data": {

0 commit comments

Comments
 (0)