def _default(self, obj):
from metamodel.metamodel import ClassDefinition, SlotDefinition, TypeDefinition<EOL>if isinstance(obj, JsonObj):<EOL><INDENT>rval = dict()<EOL>for k, v in obj.__dict__.items():<EOL><INDENT>if not k.startswith('<STR_LIT:_>') and v is not None and (not isinstance(v, (dict, list, bool)) or v):<EOL><INDENT>if isinstance(v, dict):<EOL><INDENT>itemslist = []<EOL>for vk, vv in v.items():<EOL><INDENT>if isinstance(vv, ClassDefinition):<EOL><INDENT>vv['<STR_LIT>'] = camelcase(vk)<EOL><DEDENT>elif isinstance(vv, (SlotDefinition, TypeDefinition)):<EOL><INDENT>if k != '<STR_LIT>':<EOL><INDENT>vv['<STR_LIT>'] = underscore(vk)<EOL><DEDENT><DEDENT>itemslist.append(vv)<EOL><DEDENT>rval[k] = itemslist<EOL><DEDENT>else:<EOL><INDENT>rval[k] = v<EOL><DEDENT><DEDENT><DEDENT>return rval<EOL><DEDENT>else:<EOL><INDENT>return super()._default(obj)<EOL><DEDENT>
JSON serializer callback.
        1) Filter out empty values (None, {}, [] and False) and mangle the names
        2) Add ID entries for dictionary entries

        :param obj: YAMLRoot object to serialize
        :return: Serialized version of obj