Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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

Open the file in Visual Studio Code, click the language-mode indicator in the status bar, and select JSON with Comments. VS Code calls this mode jsonc; it permits // line comments, /* ... */ block comments, and trailing commas. To make the choice apply automatically to matching filenames, add a files.associations entry that maps the pattern to jsonc.

What changes when you choose JSON with Comments?

Standard JSON is deliberately strict: it does not define comments, and the final member in an object or array cannot be followed by a comma. Visual Studio Code provides a separate language mode named JSON with Comments, with the language identifier jsonc, for configuration files that need those conveniences.

In JSONC mode, the editor accepts JavaScript-style comments in two forms:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • // comment starts a comment that runs to the end of the line.
  • /* comment */ creates a block comment that can span lines.

The mode also accepts a comma after the last property in an object or the last item in an array. VS Code’s documentation cautions that trailing commas are discouraged and the editor displays a warning for them. That warning is a style and portability signal, not an indication that JSONC mode failed.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • 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.

Changing the mode affects how VS Code parses and highlights the open document. It does not convert the file into a new format on disk, and it does not make every program that reads the file understand comments or trailing commas. A build tool, command-line parser, deployment service, or another editor may still require strict JSON. Check the consumer’s documentation before sharing a JSONC file with another tool.

Choose the right way to apply JSONC

There are two built-in approaches. Use the first when you need a quick, file-specific change; use the second when a filename or extension should always open as JSONC.

Approach Scope Persistence Best use
Language-mode indicator The currently open file Selection is convenient for the current editing session; it does not create a general filename rule Trying JSONC on one file or working on a file with an unusual name
files.associations Every file whose name or pattern matches the rule Stored in VS Code settings until you remove or change it Project-specific extensions, repeated configuration files, or a team convention

Both methods use VS Code’s built-in language support. You do not need to install an extension or purchase additional software.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change one open file to JSON with Comments

  1. Open the JSON file in VS Code.
  2. Look at the language-mode indicator on the right side of the editor status bar. It may currently read JSON, or it may show another language selected for the file.
  3. Click that indicator to open the language-mode picker.
  4. Search for or select JSON with Comments.
  5. Confirm that the indicator now reads JSON with Comments. The active language identifier is jsonc.

The editor should immediately recognize // and /* ... */ comments and stop treating them as ordinary JSON errors. A trailing comma can remain in an object or array, although VS Code may underline it with a warning because the syntax is discouraged.

This procedure changes the language mode for the file you have open. If you close the file and open a different filename later, that other file will use whatever mode its name, association rule, or saved language selection determines. For a repeatable rule, use a file association instead.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • 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

Make selected filenames open as JSONC automatically

Use the files.associations setting to map a filename pattern to jsonc. For example, the following rule makes every file ending in .myconfig open in JSON with Comments mode:

{
  "files.associations": {
    "*.myconfig": "jsonc"
  }
}

Replace *.myconfig with the pattern that matches your files. A pattern can target a custom extension, a particular filename, or another filename pattern supported by VS Code’s file-association setting. The important part is the value jsonc; that is the language identifier for JSON with Comments.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enter the association through the Settings interface

  1. Open VS Code’s Settings.
  2. Search for files associations.
  3. Find the setting named Files: Associations.
  4. Add a key for your filename or pattern and set its language value to jsonc.

This route is useful if you prefer a form-based editor and want VS Code to maintain the JSON syntax for you.

Enter the association in settings JSON

  1. Open the Command Palette.
  2. Run the command to open User Settings (JSON) or Workspace Settings (JSON), depending on where the rule should apply.
  3. Add or merge the files.associations object, preserving any settings that are already present.
  4. Save the settings file and reopen a matching configuration file if the language indicator does not update immediately.

User settings apply to your VS Code installation. Workspace settings are kept in the project’s .vscode folder and apply to that project. The exact user-settings filesystem path differs by operating system and installation type, so opening the appropriate Settings JSON command is more reliable than navigating to a hard-coded path.

If a files.associations object already exists, add another property rather than creating a second object with the same name. For example:

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【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.
{
  "editor.tabSize": 2,
  "files.associations": {
    "*.myconfig": "jsonc",
    "project.settings": "jsonc"
  }
}

After saving, files named project.settings and files ending in .myconfig should use JSONC automatically. Remove an association when you want those files to return to their normal filename-based language mode.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use comments and trailing commas correctly

Single-line comments

Put a double slash before explanatory text. The comment is ignored by JSONC parsing:

{
  // The service listens on the local development port.
  "port": 8080
}

A line comment can also follow a value, provided the value itself is complete:

{
  "port": 8080, // Change this for another local port.
  "mode": "development"
}

Block comments

Use /* and */ when an explanation spans several lines or when you want to temporarily annotate a section:

{
  /* Credentials are supplied through environment variables
     when this configuration is used in production. */
  "credentialSource": "environment"
}

Trailing commas

A trailing comma follows the final property or array item:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【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.
{
  "host": "localhost",
  "ports": [
    8080,
    8081,
  ],
}

VS Code accepts this in JSONC mode but warns that trailing commas are discouraged. The warning matters because strict JSON parsers generally reject the same text. If the file will be consumed outside VS Code, removing the final commas is the safer default:

{
  "host": "localhost",
  "ports": [
    8080,
    8081
  ]
}

Comments have the same portability issue. JSONC is an editor-oriented superset, not a replacement for the JSON grammar implemented by every external consumer.

Why VS Code’s own configuration files already work

Several VS Code configuration files are designed to use JSONC. The editor’s settings.json, tasks.json, and launch.json files are examples. They can contain comments that explain settings and, where accepted by the configuration schema, trailing commas. You normally do not need to create an association for these files; VS Code opens them with the appropriate JSONC support.

The same distinction still applies when you copy content from one of these files into another program. A VS Code configuration file working in the editor does not prove that a separate application, library, or service will accept its comments and trailing commas.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Understand the trailing-comma warning

The warning is expected behavior in JSONC mode. VS Code accepts the comma so that configuration editing is convenient, while signaling that the syntax is not ideal for interoperability. Treat the warning as a prompt to decide where the file will be used:

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【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.
  • VS Code-only configuration: You can leave the comma in place if the relevant VS Code configuration schema accepts it.
  • Input to another tool: Remove trailing commas and comments unless that tool explicitly documents JSONC support.
  • Shared or published data: Prefer strict JSON so readers and programs do not need editor-specific behavior.

Do not disable validation merely to hide the warning. Validation errors and warnings can reveal syntax that will fail after the file leaves VS Code.

Troubleshoot when comments or commas still show errors

The status bar still says JSON

The file is still using ordinary JSON mode. Click the status-bar language indicator again and select JSON with Comments. If the file repeatedly opens as JSON, add a persistent files.associations rule for its name or extension.

The association does not apply

Check the pattern character by character. An association for *.myconfig will not match a file with a different extension or spelling. Also check whether a more specific association or workspace setting is assigning another language mode. Open the file and read the status-bar indicator to see which mode actually won.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Comments work, but an external command fails

The external consumer is probably parsing strict JSON rather than JSONC. Remove // and /* ... */ comments and remove trailing commas, then run the consumer again. If comments are required for maintainers, keep a commented source configuration and generate strict JSON for the consuming program only when the tool’s workflow supports that arrangement.

VS Code underlines a trailing comma

In JSONC mode, an underline or warning on the final comma is normally the documented discouragement warning. It is different from a parse error. If portability is more important than the convenience of the comma, delete it. If the editor reports a broader syntax error, verify that the language indicator really says JSON with Comments and that every object, array, string, and comment delimiter is closed.

A comment appears inside a string

Comment markers inside quoted text are data, not comments. For example, "url": "https://example.test//path" contains a URL; the double slash does not begin a comment because it is inside the string. Move explanatory text outside the quoted value if you intended it to be a comment.

Recommended workflow for teams

  1. Decide whether the file is a VS Code configuration file or data that other programs must parse.
  2. Use JSONC only when comments or trailing commas provide a real maintenance benefit.
  3. For custom configuration extensions, commit a workspace-level files.associations rule when every contributor should receive the same editing behavior.
  4. Document the consuming tool’s syntax requirement. Do not assume that because VS Code accepts a file, a deployment or automation tool will accept it too.
  5. Before handing a file to a strict consumer, remove comments and trailing commas or use a documented conversion step.

This approach keeps the editor comfortable for human-maintained configuration while preserving a clear boundary between VS Code’s JSONC language mode and standard JSON interchange.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.