Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow json comments #124

Merged
merged 2 commits into from
Feb 3, 2021
Merged

Allow json comments #124

merged 2 commits into from
Feb 3, 2021

Conversation

hdoupe
Copy link
Collaborator

@hdoupe hdoupe commented Feb 3, 2021

Allow comments in JSON file like:

// this is my json file
// more comments here
/*
multi line comments?
*/
{
    "hello": "world",
    "allows_urls": "http://double-slash-is-ok.com"
}
In [1]: import paramtools                                                           

In [2]: s = """// this is my json file 
   ...: // more comments here 
   ...: /* 
   ...: multi line comments? 
   ...: */ 
   ...: { 
   ...:     "hello": "world", 
   ...:     "allows_urls": "http://double-slash-is-ok.com" 
   ...: }"""                                                                        

In [3]: paramtools.read_json(s)                                                     
Out[3]: 
OrderedDict([('hello', 'world'),
             ('allows_urls', 'http://double-slash-is-ok.com')])

@hdoupe hdoupe merged commit 7315209 into master Feb 3, 2021
@hdoupe hdoupe deleted the allow-json-comments branch February 3, 2021 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant