0

Is there any as3 json parser that will parse any type of comments?

I know that comments in json are kinda of grey area. I will only use json files for myself, so I am wondering how to apply comments and not create my own parser

I need comments to exclude the code while testing without deleting it.

ThanksBro
  • 911
  • 1
  • 7
  • 20
  • 2
    Might be worth a read: http://stackoverflow.com/questions/244777/can-i-comment-a-json-file – Marty Aug 21 '14 at 01:00

1 Answers1

0

The only way I can think of that wouldn't involve writing your own parser would be either to:

-Keep comments at the start/end. That way you can load the file as a string, cut off the comments, keeping a separator to know when the comments end and the data starts.

-Append the comments as part of the data. The way you'd have a JSON object with a few attributes, and a final attribute "comments", so it could get parsed without any extra effort.

These are the easiest things I can think of.

Other than that, the only real way to include your comments the way you like them, since there's no standard included in parsers, is either write your own, or find

Omar Shehata
  • 1,054
  • 14
  • 18