allow commentjson if available

Daniele NieroDaniele Niero Posts: 233 ✭✭

Hi,

I would like to ask if it possible to add support or commentjson (here) if available.

Commentjson allow us to use comments in json files.
Whatever parser library you are using in c++ already gives this options, but the standard json library in python doesn't.
Now, although some purists will tell me that json is a data format and comments are not data, the reality is that when we define custom extensions, and we are developing them, it's quite useful to temporarily comment out some file.
Again, this is possible because your c++ json parser allow that.

But I was in the need to use the ASTWrapper module from python and suddenly all my extension.fpm.json where detected as invalid, because of the comments in them.

If wherever you are importing json you write something like this instead:

try:
  import commentjson as json
except:
  import json

It will allow to use comments if the user has commentjson installed.

I believe you are using swig and this should be quite trivial.

Regards,
Daniele

Tagged:

Comments

Sign In or Register to comment.