The JSON ConfigObj Extension is a combination of the JsonConfigHandler and ConfigObjConfigHandler which allows the application to read JSON configuration files into a ConfigObj based configuration handler.


  • ConfigObj (pip install configobj)


This extension does not support any configuration settings.



    "myapp": {
        "foo": "bar"


from cement.core.foundation import CementApp

class MyApp(CementApp):
    class Meta:
        label = 'myapp'
        extensions = ['json_configobj']
        config_handler = 'json_configobj'

with MyApp() as app:

    # get config settings

    # set config settings
    app.config['myapp']['foo'] = 'bar2'

    # etc...
class cement.ext.ext_json_configobj.JsonConfigObjConfigHandler(*args, **kw)

Bases: cement.ext.ext_configobj.ConfigObjConfigHandler

This class implements the IConfig interface, and provides the same functionality of ConfigObjConfigHandler but with JSON configuration files.

Note This extension has an external dependency on ConfigObj. You must include configobj in your application’s dependencies as Cement explicitly does not include external dependencies for optional extensions.

class Meta

Handler meta-data.

json_module = 'json'

Backend JSON module to use (json, ujson, etc)

label = 'json_configobj'

The string identifier of this handler.


Parse JSON configuration file settings from file_path, overwriting existing config settings. If the file does not exist, returns False.

Parameters:file_path – The file system path to the JSON configuration file.

The _setup function is called during application initialization and must setup the handler object making it ready for the framework or the application to make further calls to it.

Parameters:app_obj – The application object.