Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Strict JSON does not allow comments or trailing commas. If a JSON parser rejects a file containing //, /* ... */, or a comma immediately before } or ], remove those constructs and validate the result with the parser that will actually read it. If you need comments or trailing commas, deliberately use a compatible format such as JSONC or JSON5—and confirm that every part of the toolchain supports it.
How do I fix a JSON parsing error caused by comments?
Remove comments when the file must be standard JSON. The JSON grammar defined by RFC 8259 has no comment syntax, so a strict JSON parser can reject comments even if your editor colors them like code comments. JSON is a data format, not a JavaScript object literal.
For example, this object is invalid as strict JSON because it contains both a line comment and a trailing comma:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute{
"name": "Ada", // comment
"active": true,
}
Delete the comment and the comma after the final member:
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
{
"name": "Ada",
"active": true
}
The comma between "Ada" and "active" stays: commas separate entries. The comma after true does not separate anything, because the object closes immediately afterward.
What counts as a comment problem?
Both JavaScript-style line comments and block comments are outside strict JSON. A line comment begins with // and continues to the line ending. A block comment begins with /* and ends with */, potentially spanning several lines. Neither token appears in the JSON grammar. A parser may therefore fail as soon as it reaches the first slash, or it may report a later character after it has already become unable to continue.
Comments can appear after a value, between members, or on a line by themselves. All of those placements are invalid in strict JSON:
{
/* account label */
"name": "Ada",
"active": true // enabled for testing
}
Removing the comment means removing only the comment text, not the quoted value or its separator:
{
"name": "Ada",
"active": true
}
Be especially careful when a string contains comment-like characters. This is valid strict JSON because the slashes are data inside a quoted string:
{
"url": "https://example.test/a//b",
"pattern": "/* not a comment */"
}
A blind search-and-replace that deletes every // or /* ... */ sequence can corrupt those values. Comment removal must understand whether the characters are inside a JSON string, or it must be done by hand with the surrounding syntax in view.
Repair comments without damaging data
- Look at the reported location and nearby text. Find the surrounding object or array, not just the character named in the error.
- Identify whether the slash is syntax or data. A slash inside quoted text is part of the string; an unquoted slash is a likely comment token in an extension format.
- Remove comment syntax from the JSON source. Delete the comment itself while keeping the data before and after it intact.
- Check the affected separators. Keep commas between members or values; remove a comma if it is the final character before a closing brace or bracket.
- Parse the edited text again with the intended consumer. A successful check in one editor or parser does not establish that a different downstream reader accepts the same format.
Do not strip comments with a broad regular-expression replacement as a universal fix. Text such as // or /* ... */ can occur inside a string value; a naive replacement may alter the value rather than remove a comment. For a small file, careful editing is safer. If comments are a lasting requirement, choose a comment-aware format and reader instead of repeatedly modifying the file into strict JSON.
Why does my JSON parser reject a trailing comma?
In strict JSON, an object contains quoted string member names and comma-separated members, while an array contains comma-separated values. The comma separates one entry from another; it is not permitted after the last entry immediately before the closing delimiter. That is why a JavaScript-style object that ends an entry with a comma may fail when treated as JSON. RFC 8259 defines the JSON syntax; it does not include a final comma in either structure.
Fix a trailing comma in an object
Invalid strict JSON:
{
"name": "Ada",
"active": true,
}
Valid strict JSON:
{
"name": "Ada",
"active": true
}
Remove only the comma after the last member. Do not remove the comma between the two members. The same rule applies to an object with one member:
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
{
"id": 42,
}
becomes:
{
"id": 42
}
Fix a trailing comma in an array
Invalid strict JSON:
{
"colors": ["red", "blue",]
}
Valid strict JSON:
{
"colors": ["red", "blue"]
}
Here, remove the comma after "blue", immediately before ]. The comma between "red" and "blue" remains because it separates array values. An array with one value follows the same pattern:
[true,]
must become:
[true]
Check nested objects and arrays
Trailing commas often hide in a nested structure rather than at the top level. Inspect every closing brace and bracket:
Free tools Windows power users keep installed
One-click scans. No signup required.
{
"user": {
"name": "Ada",
"roles": [
"admin",
"reviewer",
],
}
}
There are three trailing commas here: after "reviewer", after the roles array, and after the user object. A strict version removes each final comma while retaining separators between earlier values:
{
"user": {
"name": "Ada",
"roles": [
"admin",
"reviewer"
]
}
}
Formatting can make this easier to audit. Pretty-printing does not change the grammar, but placing each member or value on its own line makes the character before every closing delimiter visible.
Why the reported position may look misleading
Some parsers report the position of the next token they cannot accept. With a trailing comma, that may be the closing } or ], rather than the comma itself. Treat this as a debugging heuristic, not a guarantee: parser messages and location conventions depend on the implementation. Inspect the structure around the reported line, column, or offset if it is available.
If the error points at a closing delimiter, look immediately to its left for a comma. If it points at a comma, verify that the comma is between two complete members or values rather than after the final one. Also inspect the previous nesting level: a missing quote, brace, or bracket earlier in the file can make a later comma appear to be the problem.
What strict JSON actually permits
Understanding the small set of separators helps distinguish a real trailing comma from a different syntax error. An object starts with {, contains zero or more members, and ends with }. Each member has a quoted string name, a colon, and a value. Commas go only between adjacent members.
{
"first": 1,
"second": 2
}
An array starts with [, contains zero or more values, and ends with ]. Commas go only between adjacent values.
[1, 2, 3]
Empty structures have no comma at all:
{}
[]
Whitespace around tokens is allowed, so moving a comma to its own line does not make it a trailing comma exception. The important question is whether another member or value follows it before the closing delimiter.
Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
JSON also requires object member names to be quoted strings. This JavaScript object literal is not strict JSON for two independent reasons: the key is unquoted and the final comma is present.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →{
name: "Ada",
}
The strict form is:
{
"name": "Ada"
}
Fixing comments and commas may expose another JavaScript-only feature, such as single-quoted strings, an unquoted key, or a value that JSON does not define. Validate the complete document rather than stopping after the first visible repair.
Can JSON have comments or a comma after the last item?
Not in strict JSON. JSONC and JSON5 are separate, explicitly extended formats that support syntax strict JSON rejects. A filename or an editor that accepts an extension does not, by itself, make a receiving application compatible with that format.
| Need | Suitable route | What to verify |
|---|---|---|
| Data for APIs, exchange between systems, or an unknown JSON parser | Use strict JSON: remove comments and trailing commas. | Validate with the same parser or consumer used in production. |
| Comments in a configuration file | Use JSONC with a JSONC-aware parser. | Confirm the application accepts JSONC and check how its parser handles trailing commas. |
| Comments and trailing commas, plus other relaxed syntax | Use JSON5 with a JSON5-aware parser. | Confirm the consumer accepts JSON5 and review other syntax changes before converting. |
JSONC: comments, but check trailing-comma behavior
JSONC adds JavaScript-style comments and is commonly used for configuration. Its specification makes trailing commas optional, so support for them should not be assumed. In the reference jsonc-parser implementation, the allowTrailingComma option is false by default; its documentation states: “The allowTrailingComma option is set to false by default, so any trailing comma will result in a parsing error.” Check the receiving application’s actual parser behavior and configuration. See the JSONC specification.
This means a file can be valid JSONC because its comments are accepted while still failing because its final comma is disabled. If you control the parser, determine whether an option exists and what its default is. If you do not control the parser, omit trailing commas even in a comment-bearing configuration unless the application’s documentation explicitly permits them.
The JSONC documentation recommends the .jsonc extension and cautions against transmitting JSONC as application/json: a JSON-only consumer may reject or misinterpret it. File naming and content type do not substitute for confirming that the reader supports JSONC. See the JSONC specification.
JSON5: an extension, not a strict-JSON repair
JSON5 supports comments and trailing commas, along with other syntax extensions. Choose it only when the parser and every downstream consumer are intended to read JSON5. A document that parses as JSON5 is not thereby standard JSON, and a strict JSON consumer may still reject it.
Because JSON5 changes more than the two constructs causing this error, review the entire document when adopting it. Confirm which JSON5 features are accepted by the parser, how the file is identified, and whether another service later forwards or stores the text as ordinary JSON. If any handoff expects strict JSON, convert the document to strict syntax before that boundary by removing comments, removing final commas, and checking for other extension-only constructs.
A reliable diagnosis and repair workflow
Use a repeatable process rather than deleting characters until one particular editor stops complaining.
Recommended Free Tools
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
- Preserve the original. Make a copy or use version control so you can compare the repaired document with the source. This helps catch accidental changes inside strings.
- Read the parser’s location as a neighborhood, not a verdict. Examine several characters before and after the reported line, column, or offset. Look for a slash, a comma before
}or], an unmatched quote, or an earlier missing delimiter. - Determine the required format. Ask whether the destination requires standard JSON, JSONC, JSON5, or another documented format. Do not infer the answer from syntax highlighting.
- Make the smallest compatible edit. For strict JSON, remove comments and final commas. Keep commas that separate entries, preserve string contents, and avoid unrelated reformatting.
- Validate the complete file. Parse the exact bytes or text that the application will consume. A small pasted fragment can be valid while the full file still contains another comment or trailing comma.
- Validate at the boundary. If one program writes the file and another reads it, test the reader’s parser, not only the writer or an editor. Check any content type and file-extension conventions used in transfer.
- Retest after generation. If a template, formatter, or build step recreates the file, fix that generator or its settings; otherwise the same invalid comma or comment will return.
This workflow also separates syntax errors from semantic errors. Once parsing succeeds, the consumer may still reject an unknown property, wrong data type, or missing required value. Those are different validation stages and need different fixes.
Choose the right repair for the file’s destination
Use the destination—not just the editor’s behavior—to decide what to change. When the destination is unknown or expects ordinary JSON, strict JSON is the compatibility-first option: remove comments, remove final commas, and validate with the receiving parser. For a controlled configuration workflow, JSONC or JSON5 can be appropriate if the application explicitly supports that format.
- Keep strict JSON for data sent to APIs or exchanged with systems whose parser requirements you do not control.
- Choose JSONC when comments are useful in configuration and the reader is JSONC-aware; verify trailing-comma handling separately.
- Choose JSON5 when its broader syntax is intentional and all relevant readers support it.
- Do not rename the file and assume it is fixed. The parser and downstream consumer must agree on the format.
- Do not advertise an extension as
application/json. JSONC documentation specifically warns that a JSON-only consumer may reject or misinterpret JSONC sent with that media type.
Common pitfalls
Confusing editor acceptance with interchange compatibility
An editor may offer comments, trailing-comma settings, or syntax highlighting for convenience. That feature says what the editor can display or parse, not what an API, build tool, or deployment service accepts. Always test with the actual consumer.
Removing every comma
Commas between members and values are required. Deleting all commas turns a trailing-comma problem into a missing-separator problem. Remove only the comma whose next significant token is } or ].
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsChanging the media type without changing the parser
Calling a JSONC document application/json, or sending JSON5 text to a strict JSON endpoint, does not convert the syntax. The receiving parser still determines whether the payload is accepted.
Using a regular expression as a parser
Nested structures, escaped quotes, and comment-like characters inside strings make broad text substitutions unsafe. Prefer a parser for the intended format or make deliberate, local edits followed by validation.
Assuming all JSONC parsers agree
JSONC permits implementations to differ on optional trailing-comma support. Verify the specific parser and its options, including defaults. A configuration that works in one JSONC-aware tool may fail in another if trailing commas are disabled.
Final validation checklist
After editing, check the exact text that will be consumed, not only a simplified excerpt.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Confirm that every comment has been removed when strict JSON is required.
- Confirm that no comma appears immediately before a closing brace or bracket.
- Confirm that commas between entries remain.
- Confirm that object names use double quotes and that strings use valid JSON quoting.
- Inspect nested objects and arrays, including empty structures.
- Check that comment-like characters inside strings were preserved.
- Parse the file using the actual intended reader.
- If the file is JSONC or JSON5, confirm that the receiving application explicitly supports that format.
- For JSONC, verify the parser’s trailing-comma option rather than assuming it is enabled.
- Verify the file extension and media type used at every transfer boundary.
If the document still fails, return to the first reported location and inspect the preceding structure. A later error can be a consequence of an earlier missing quote, bracket, or brace. Repair the earliest structural mistake you can identify, then parse again.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Frequently Asked Questions
Can I leave comments in a JSON file if my editor accepts them?
Only if the file is intentionally JSONC, JSON5, or another documented extension and every reader supports that format. A strict JSON consumer will reject comments even when an editor displays them without complaint.
Why does the error point at } or ] instead of the trailing comma?
A parser may report the next token it cannot accept. When a comma appears before a closing delimiter, that next token is often } or ]. Inspect the characters immediately before the reported location, while remembering that location conventions vary by implementation.
Are trailing commas valid in JSONC?
JSONC makes trailing-comma support optional. The reference jsonc-parser option allowTrailingComma is false by default, so verify the receiving application’s parser and configuration instead of assuming a trailing comma will work.
Does JSON5 solve a strict JSON parsing error automatically?
No. JSON5 supports comments and trailing commas, but it is a distinct format with additional syntax extensions. The consumer must explicitly parse JSON5; merely changing a filename or editor setting does not make a strict JSON endpoint accept it.
Should I remove comments with a regular expression?
Not as a universal fix. Comment-like sequences can occur inside quoted strings, and a broad replacement can corrupt data. Use a parser for the intended format or make careful edits and validate the complete file afterward.
What is the safest format for an API payload?
Use strict JSON unless the API documentation explicitly specifies JSONC, JSON5, or another extension. Remove comments and commas immediately before } or ], then validate with the same parser or service that will receive the payload.
Does whitespace or a newline after a comma make it valid?
No. Whitespace is allowed around JSON tokens, but a comma is still trailing if the next significant token is the closing } or ]. Remove that comma while keeping separators between entries.
Why does fixing one comma reveal another error?
The file may contain multiple independent issues, often in nested arrays or objects. It may also contain another extension-only feature, such as an unquoted key or single-quoted string. Validate the whole document after each structural repair.
The Bottom Line
For standard JSON, remove every comment and every comma immediately before } or ], keep commas that separate entries, and validate with the actual receiving parser. If annotations or trailing commas are a deliberate requirement, adopt JSONC or JSON5 explicitly, verify parser options and media types, and ensure the complete toolchain supports the chosen format.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

