Skip to content

Fix invalid JSON in documentation code examples - #45879

Merged
mchammer01 merged 2 commits into
github:mainfrom
SurefireStudios:fix/invalid-json-code-examples
Sep 15, 2026
Merged

mchammer01 merged 2 commits into
github:mainfrom
SurefireStudios:fix/invalid-json-code-examples

Conversation

@SurefireStudios

@SurefireStudios SurefireStudios commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Why:

Closes:

No existing issue — this is a technical correction found by parsing every fenced json block in content/.

Six json code blocks across five articles are not valid JSON. Each is a one-character fix: one missing comma and five trailing commas.

Two of them are tagged json copy, so the site renders a copy button on a sample that will not parse where the reader pastes it:

  • Customize containers used by jobs — the prepare_job example is missing the comma after "image": "node:18". Line 295 of the same file has the comma in the equivalent spot, so this is a typo rather than a house style.
  • About Copilot hooks — trailing comma after the sessionStart array, in the block that introduces the hook configuration format.

The other three are trailing commas, which JSON does not permit:

The last one is under content/rest/, but it's a hand-written guide rather than the generated REST reference, so it isn't covered by the "we cannot accept contributions to the REST API reference documentation" rule. Happy to drop it from this PR if you'd rather keep content/rest/ changes separate.

What's being changed (if available, include any code snippets, screenshots, or gifs):

Nine lines, all commas. No prose, structure, or sample values were touched.

File Fix
actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md Add missing comma after "image": "node:18"
copilot/concepts/agents/hooks.md Remove trailing comma after sessionStart array
actions/reference/workflows-and-actions/expressions.md Remove 4 trailing commas
actions/tutorials/publish-packages/publish-nodejs-packages.md Remove trailing comma after repository
rest/using-the-rest-api/github-event-types.md Remove trailing comma after org

The customize-containers.md one, as an example:

       "jobContainer": {
-        "image": "node:18"
+        "image": "node:18",
         "workingDirectory": "/__w/octocat-test2/octocat-test2",

How this was found and checked. I extracted every fenced ```json block under content/ and ran it through a JSON parser, before and after. These five files go from six failing blocks to zero, and no other block changes state.

Blocks that are meant to be invalid were deliberately left alone — the "common validation errors when creating issue forms" examples, the newline-delimited JSON in copilot-usage-metrics/team-level-metrics.md, the /* hook entries */ placeholder in hooks-reference.md, and the parse-error demonstrations in workflow-syntax.md.

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.

    Accuracy here is machine-checkable rather than a judgement call: each block either parses as JSON or it doesn't, and no documented value or key was changed. That said, please do sanity-check that none of the six was intentionally invalid — I believe none were, but you know the content better than a parser does.

  • The changes in this PR meet the docs fundamentals that are required for all content.

  • All CI checks are passing and the changes look good in the review environment.

    Confirmed after opening: 44 checks passing, 7 skipped (the maintainer-only workflows), none failing — content-linter included.

Six fenced `json` blocks across five articles do not parse. Each is a
one-character fix: one missing comma and five trailing commas.

The two most visible are tagged `json copy`, so the site renders a copy
button on a sample that will not parse where the reader pastes it:

- `customize-containers.md` is missing the comma after `"image": "node:18"`.
  Line 295 of the same file has the comma, so this is a typo rather than a
  house style.
- `hooks.md` has a trailing comma after the `sessionStart` array.

The rest are trailing commas, which JSON does not allow:

- `expressions.md` — the `vegetables` object and the filter-result array
- `publish-nodejs-packages.md` — after the `repository` object. A
  `package.json` with this trailing comma is rejected by npm.
- `github-event-types.md` — after the `org` object

Verified by parsing every fenced `json` block in `content/` before and
after: these five files go from six failing blocks to zero, and no other
block changes state. Blocks that are deliberately invalid were left alone,
including the "common validation errors" examples, the newline-delimited
JSON in `team-level-metrics.md`, and the `/* hook entries */` placeholder
in `hooks-reference.md`.
Copilot AI balanced review requested due to automatic review settings September 14, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the triage Do not begin working on this issue until triaged by the team label Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

The table shows the files in the content directory that were changed in this pull request. This helps you review your changes on a staging server. Changes to the data directory are not included in this table.

Source Review Production What Changed
actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md fpt
ghec
fpt
ghec
actions/reference/workflows-and-actions/expressions.md fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17
fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17
actions/tutorials/publish-packages/publish-nodejs-packages.md fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17
fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17
copilot/concepts/agents/hooks.md fpt
ghec
fpt
ghec
rest/using-the-rest-api/github-event-types.md fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17
fpt
ghec
ghes@ 3.22 3.21 3.20 3.19 3.18 3.17

Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server

🤖 This comment is automatically generated.

@plooolp

This comment was marked as off-topic.

@plooolp

This comment was marked as off-topic.

@plooolp

This comment was marked as off-topic.

@plooolp

This comment was marked as off-topic.

@plooolp

This comment was marked as off-topic.

@plooolp

This comment was marked as off-topic.

@janiceilene

Copy link
Copy Markdown
Contributor

👋 @SurefireStudios Thanks for opening a PR! I'll get this triaged for the team to review.

@janiceilene janiceilene added builder persona and removed triage Do not begin working on this issue until triaged by the team labels Sep 15, 2026

@mchammer01 mchammer01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SurefireStudios👋🏻 - Thanks for spotting and fixing these invalid JSON examples. The changes are clear, accurate, and nicely scoped. I’ve checked the updated examples and all six now parse correctly. Thanks for contributing 💖

@mchammer01
mchammer01 added this pull request to the merge queue Sep 15, 2026
Merged via the queue into github:main with commit b32e08f Sep 15, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants