jsonutils#

config_patterns.jsonutils.strip_comment_line_with_symbol(line: str, comment_symbol: str)[source]#

Strip comments from line string.

Parameters:
  • line – the single line string that you want to strip out comments.

  • comment_symbol – the comment char that indicate that the comment starts from.

config_patterns.jsonutils.strip_comments(text: str, comment_symbols=frozenset({'#', '//'}))[source]#

Strip comments from json string.

Parameters:
  • text – A string containing json with comments started by comment_symbols.

  • comment_symbols – Iterable of symbols that start a line comment (default # or //).

Returns:

The string with the comments removed.