public sealed class Settings : objectSettings controlling JSON formatting.
Namespace
Google.ProtobufAssembly
Google.Protobuf.dll
Constructors
Settings(Boolean)
public Settings(bool formatDefaultValues)Creates a new JsonFormatter.Settings object with the specified formatting of default values and an empty type registry.
| Parameter | |
|---|---|
| Name | Description | 
formatDefaultValues | 
        Boolean
  | 
      
Settings(Boolean, TypeRegistry)
public Settings(bool formatDefaultValues, TypeRegistry typeRegistry)Creates a new JsonFormatter.Settings object with the specified formatting of default values and type registry.
| Parameters | |
|---|---|
| Name | Description | 
formatDefaultValues | 
        Boolean
  | 
      
typeRegistry | 
        TypeRegistryThe TypeRegistry to use when formatting Any messages.  | 
      
Properties
Default
public static JsonFormatter.Settings Default { get; }Default settings, as used by Default
| Property Value | |
|---|---|
| Type | Description | 
JsonFormatter.Settings | 
        |
FormatDefaultValues
public bool FormatDefaultValues { get; }Whether fields which would otherwise not be included in the formatted data should be formatted even when the value is not present, or has the default value. This option only affects fields which don't support "presence" (e.g. singular non-optional proto3 primitive fields).
| Property Value | |
|---|---|
| Type | Description | 
Boolean | 
        |
FormatEnumsAsIntegers
public bool FormatEnumsAsIntegers { get; }Whether to format enums as ints. Defaults to false.
| Property Value | |
|---|---|
| Type | Description | 
Boolean | 
        |
TypeRegistry
public TypeRegistry TypeRegistry { get; }The type registry used to format Any messages.
| Property Value | |
|---|---|
| Type | Description | 
TypeRegistry | 
        |
Methods
WithFormatDefaultValues(Boolean)
public JsonFormatter.Settings WithFormatDefaultValues(bool formatDefaultValues)Creates a new JsonFormatter.Settings object with the specified formatting of default values and the current settings.
| Parameter | |
|---|---|
| Name | Description | 
formatDefaultValues | 
        Boolean
  | 
      
| Returns | |
|---|---|
| Type | Description | 
JsonFormatter.Settings | 
        |
WithFormatEnumsAsIntegers(Boolean)
public JsonFormatter.Settings WithFormatEnumsAsIntegers(bool formatEnumsAsIntegers)Creates a new JsonFormatter.Settings object with the specified enums formatting option and the current settings.
| Parameter | |
|---|---|
| Name | Description | 
formatEnumsAsIntegers | 
        Boolean
  | 
      
| Returns | |
|---|---|
| Type | Description | 
JsonFormatter.Settings | 
        |
WithTypeRegistry(TypeRegistry)
public JsonFormatter.Settings WithTypeRegistry(TypeRegistry typeRegistry)Creates a new JsonFormatter.Settings object with the specified type registry and the current settings.
| Parameter | |
|---|---|
| Name | Description | 
typeRegistry | 
        TypeRegistryThe TypeRegistry to use when formatting Any messages.  | 
      
| Returns | |
|---|---|
| Type | Description | 
JsonFormatter.Settings | 
        |