jsonString(from:options:)

Returns a string containing the JSON serialization of the messages.

Message+JSONArrayAdditions.swift:29
static func jsonString<C>(from collection: C, options: JSONEncodingOptions = JSONEncodingOptions()) throws -> String where Self == C.Element, C : Collection

Parameters

collection

The list of messages to encode.

options

The JSONEncodingOptions to use.

Returns

A string containing the JSON serialization of the messages.

Throws

SwiftProtobufError or JSONEncodingError if encoding fails.

Unlike binary encoding, presence of required fields is not enforced when serializing to JSON.