Options for serializing to JSON.

interface JsonWriteOptions {
    emitDefaultValues: boolean;
    enumAsInteger: boolean;
    typeRegistry?: IMessageTypeRegistry;
    useProtoFieldName: boolean;
}

Hierarchy (view full)

Properties

emitDefaultValues: boolean

Emit fields with default values: Fields with default values are omitted by default in proto3 JSON output. This option overrides this behavior and outputs fields with their default values.

enumAsInteger: boolean

Emit enum values as integers instead of strings: The name of an enum value is used by default in JSON output. An option may be provided to use the numeric value of the enum value instead.

typeRegistry?: IMessageTypeRegistry

This option is required to write google.protobuf.Any to JSON format.

useProtoFieldName: boolean

Use proto field name instead of lowerCamelCase name: By default proto3 JSON printer should convert the field name to lowerCamelCase and use that as the JSON name. An implementation may provide an option to use proto field name as the JSON name instead. Proto3 JSON parsers are required to accept both the converted lowerCamelCase name and the proto field name.

Generated using TypeDoc