def FormatMessageAsJson(type_context, msg):
    'Format a message definition DescriptorProto as a pseudo-JSON block.\n\n  Args:\n    type_context: contextual information for message/enum/field.\n    msg: message definition DescriptorProto.\n  Return: RST formatted pseudo-JSON string representation of message definition.\n  '
    lines = []
    for (index, field) in enumerate(msg.field):
        field_type_context = type_context.ExtendField(index, field.name)
        leading_comment = field_type_context.leading_comment
        if HideNotImplemented(leading_comment):
            continue
        lines.append(('"%s": %s' % (field.name, FormatFieldTypeAsJson(type_context, field))))
    if lines:
        return (('.. code-block:: json\n\n  {\n' + ',\n'.join(IndentLines(4, lines))) + '\n  }\n\n')
    else:
        return '.. code-block:: json\n\n  {}\n\n'
Format a message definition DescriptorProto as a pseudo-JSON block.

Args:
  type_context: contextual information for message/enum/field.
  msg: message definition DescriptorProto.
Return: RST formatted pseudo-JSON string representation of message definition.
def FormatMessageAsJson(type_context, msg):
    'Format a message definition DescriptorProto as a pseudo-JSON block.\n\n  Args:\n    type_context: contextual information for message/enum/field.\n    msg: message definition DescriptorProto.\n  Return: RST formatted pseudo-JSON string representation of message definition.\n  '
    lines = []
    for (index, field) in enumerate(msg.field):
        field_type_context = type_context.ExtendField(index, field.name)
        leading_comment = field_type_context.leading_comment
        if HideNotImplemented(leading_comment):
            continue
        lines.append(('"%s": %s' % (field.name, FormatFieldTypeAsJson(type_context, field))))
    if lines:
        return (('.. code-block:: json\n\n  {\n' + ',\n'.join(IndentLines(4, lines))) + '\n  }\n\n')
    else:
        return '.. code-block:: json\n\n  {}\n\n'