6

Some date is stored in a json file, how can I comment out some lines like below?

[
    {
        "id":"aaaa",
    //  "path": "xxxx",
        "path": "yyyy"
    },
   {
       "id":"bbbb",
       "path": "cccc"
    }
]

My IDE is Visual Studio.

diwatu
  • 5,641
  • 5
  • 38
  • 61
  • 2
    JSON does not allow comments. There is simply no provision for comments in the syntax. – Pointy Jan 19 '15 at 17:50
  • You can't comment json. You can decode the json into a native structure, REMOVE the unwanted bits, then re-encode to json, effectively deleting the unwated stuff. – Marc B Jan 19 '15 at 17:51
  • 1
    [Note that the lack of comments has been controversial at times.](http://blog.getify.com/json-comments/) – Pointy Jan 19 '15 at 17:52

1 Answers1

1

Is it an asp.net project (you mention you're using Visual Studio)? If so you could store the json data as a view and use server side commenting out, e.g. in razor:

@* "path": "yyyy", *@
stovroz
  • 6,835
  • 2
  • 48
  • 59