docstr: Convert HOCON input into a JSON output
  
  :return: JSON string representation
  :type return: basestring
docstr_tok: ["Convert","HOCON","input","into","a","JSON","output",":","return",":","JSON","string","representation",":","type","return",":","basestring"]
code: def to_json(cls, config, compact=False, indent=2, level=0):
      """Convert HOCON input into a JSON output
  
      :return: JSON string representation
      :type return: basestring
      """
      lines = ""
      if isinstance(config, ConfigTree):
          if len(config) == 0:
              lines += "{}"
          else:
              lines += "{\n"
              bet_lines = []
              for key, item in config.items():
                  bet_lines.append(
                      '{indent}"{key}": {value}'.format(
                          indent="".rjust((level + 1) * indent, " "),
                          key=key.strip(
                              '"'
                          ),  # for dotted keys enclosed with "" to not be interpreted as nested key
                          value=cls.to_json(
                              item, compact, indent, level + 1
                          ),
                      )
                  )
              lines += ",\n".join(bet_lines)
              lines += "\n{indent}}}".format(
                  indent="".rjust(level * indent, " ")
              )
      elif isinstance(config, list):
          if len(config) == 0:
              lines += "[]"
          else:
              lines += "[\n"
              bet_lines = []
              for item in config:
                  bet_lines.append(
                      "{indent}{value}".format(
                          indent="".rjust((level + 1) * indent, " "),
                          value=cls.to_json(
                              item, compact, indent, level + 1
                          ),
                      )
                  )
              lines += ",\n".join(bet_lines)
              lines += "\n{indent}]".format(
                  indent="".rjust(level * indent, " ")
              )
      elif isinstance(config, basestring):
          lines = json.dumps(config)
      elif config is None or isinstance(config, NoneValue):
          lines = "null"
      elif config is True:
          lines = "true"
      elif config is False:
          lines = "false"
      else:
          lines = str(config)
      return lines
  
file_path: clearml/clearml/utilities/pyhocon/converter.py
imports: import json
  import re
  import sys
  from .None import ConfigFactory
  from .config_tree import ConfigQuotedString
  from .config_tree import ConfigSubstitution
  from .config_tree import ConfigTree
  from .config_tree import ConfigValues
  from .config_tree import NoneValue
label_desc: Use image node_id 1 for calling the HOCONConverter obj's underlying member method code with example usage: obj.to_json(cls, config, compact, indent, level) and returns: lines