jsonUTF8Data(from:options:)

Returns a Data containing the UTF-8 JSON serialization of the messages.

Message+JSONArrayAdditions_Data.swift:69
static func jsonUTF8Data<C>(from collection: C, options: JSONEncodingOptions = JSONEncodingOptions()) throws -> Data where Self == C.Element, C : Collection

Parameters

collection

The list of messages to encode.

options

The JSONEncodingOptions to use.

Returns

A Data 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.