JsonConfig

JsonConfig - ImportConfig subclass for loading JSON files.

class importconfig.jsonconfig.JsonConfig(file_path, lazy=False)[source]

Bases: importconfig.importconfig.ImportConfig

JsonConfig will load a JSON file into a dict.

It can be used with UltraJSON, simplejson or the built in json module.

Parameters:
  • file_path (str) – The path to the JSON file that will be loaded
  • lazy (bool, optional) – Do not load the JSON file immediately in the constructor. default: False
importconfig.jsonconfig.jsonconfig(file_path, lazy=False)[source]

Will load a JSON file into a dict.

Expanding any "@file" attributes that are found a long the way. It can be used with UltraJSON, simplejson or the built in json module.

Note

Using this method is the same as calling JsonConfig(file_path, lazy=False).load()

Parameters:
  • file_path (str) – The path to the JSON file that will be loaded
  • lazy (bool, optional) – Do not load the JSON file immediately in the constructor. default: False
Returns:

If lazy=True it will return an instance of JsonConfig else a dict will be returned.