[Python-ideas] It would be great if the json module would allow and clear existing comments.

João Matos jcrmatos at gmail.com
Thu Dec 13 07:23:45 EST 2018


Hello,

Comments in JSON files are a great way to document a configuration file for 
example.
Even JSON's Douglas Crockford agrees that it is a helpful thing and it 
suggests using JSMin before handing it to the JSON parser in here
https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaGSr

So, I would like to suggest adding that feature do the json module.
A simple boolean argument, clear_comments, with the default False to keep 
previous compatibility.
With the clear_comments=True and following JSMin "rules", comments in the 
// form should be replaced with linefeeds and comments in the /* */ form 
with spaces.

Best regards,

JM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181213/1c4e06b3/attachment.html>


More information about the Python-ideas mailing list