j0ack / discirc

mirrored from https://git.joakode.fr/joack/discirc
http://docs.joakode.fr/discirc/
GNU General Public License v3.0
9 stars 8 forks source link

json doesn't do comments #4

Closed TeoTwawki closed 7 years ago

TeoTwawki commented 7 years ago

Your example file will lead inexperienced users to create broken configs and then be confused as to why it isn't working. Also you have an extra comma on line 14. If you want `//comments you will need something to strip those out before feeding it to the json decoder.

j0ack commented 7 years ago

You're absolutely right.

Would you consider to modify JSON parsing and sending me a PR ? I don't have much time implementing this right now.

TeoTwawki commented 7 years ago

Unfortunately I don't have a solid solution that performs well to just toss into your project.

But what I could do is make the example file just a document quoting the json structure within, so people don't mistake it for a file they can just edit and use.

Work for you?

j0ack commented 7 years ago

Well I find an inelegant way to do this using a "__comment" key which will not be parsed in the config. I'll implement this asap still looking for a better solution.

TeoTwawki commented 7 years ago

JSON.minify() can do this but its slow. I'm not familar with other methods.