question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comments in JSON files

See original GitHub issue

Hello, myjson files have comments, I don’t want to delete them. But your plugin doesn’t format files with comments.

For example, beginning of my file:

[
    // Scroll bar
    {
        "class": "scroll_bar_control",
        "layer0.tint": [0, 250, 154],
        "layer0.opacity": 1,
    },

When I try to format a code, in Status Bar appears:

Expecting object: line 2 column 5 (char 6),

Expecting object

If I type in this file in the command palette Pretty JSON: Validate, a dialog box appears with the inscription:

Invalid JSON

Invalid JSON

In files that do not contain comments JSON is valid. How can I format my file contains comments?

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
sweetw0rcommented, Mar 1, 2017

@Kristinita, I saw it and disagree!

0reactions
Kristinitacommented, Mar 1, 2017

@sweetw0r , see my previous comment.

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Comment Example — How to Comment in JSON Files
A way to skirt around the comments issue is to add data to your JSON file that function as comments. ... Here's another...
Read more >
Can comments be used in JSON? - Stack Overflow
JSON does not support comments natively, but you can make your own decoder or at least preprocessor to strip out comments ...
Read more >
Multiple ways to write JSON Comments - W3schools.io
One way is using adding key-value pairs with comments and descriptions JSOn always contains data of keys and values, so add the comments...
Read more >
commentjson - Add comments in JSON files — commentjson ...
commentjson allows you to deserialize JSON files with Python and JavaScript style comments in them. commentjson 's API is the same as the...
Read more >
How to write comments inside a JSON document - Quora
Comments are not supported in JSON documents. This decision was taken by its designer Douglas Crockford because people were using them to hold...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found