def _RegularMessageToJsonObject(message, js, including_default_value_fields):
fields = message.ListFields()<EOL>include_default = including_default_value_fields<EOL>try:<EOL><INDENT>for field, value in fields:<EOL><INDENT>name = field.camelcase_name<EOL>if _IsMapEntry(field):<EOL><INDENT>v_field = field.message_type.fields_by_name['<STR_LIT:value>']<EOL>js_map = {}<EOL>for key in value:<EOL><INDENT>if isinstance(key, bool):<EOL><INDENT>if key:<EOL><INDENT>recorded_key = '<STR_LIT:true>'<EOL><DEDENT>else:<EOL><INDENT>recorded_key = '<STR_LIT:false>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>recorded_key = key<EOL><DEDENT>js_map[recorded_key] = _FieldToJsonObject(<EOL>v_field, value[key], including_default_value_fields)<EOL><DEDENT>js[name] = js_map<EOL><DEDENT>elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:<EOL><INDENT>js[name] = [_FieldToJsonObject(field, k, include_default)<EOL>for k in value]<EOL><DEDENT>else:<EOL><INDENT>js[name] = _FieldToJsonObject(field, value, include_default)<EOL><DEDENT><DEDENT>if including_default_value_fields:<EOL><INDENT>message_descriptor = message.DESCRIPTOR<EOL>for field in message_descriptor.fields:<EOL><INDENT>if ((field.label != descriptor.FieldDescriptor.LABEL_REPEATED and<EOL>field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE) or<EOL>field.containing_oneof):<EOL><INDENT>continue<EOL><DEDENT>name = field.camelcase_name<EOL>if name in js:<EOL><INDENT>continue<EOL><DEDENT>if _IsMapEntry(field):<EOL><INDENT>js[name] = {}<EOL><DEDENT>elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:<EOL><INDENT>js[name] = []<EOL><DEDENT>else:<EOL><INDENT>js[name] = _FieldToJsonObject(field, field.default_value)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except ValueError as e:<EOL><INDENT>raise SerializeToJsonError(<EOL>'<STR_LIT>'.format(field.name, e))<EOL><DEDENT>return js<EOL>
Converts normal message according to Proto3 JSON Specification.