Type Method

writeJSONObject(_:to:options:error:)

Writes a given JSON object to a stream.

Declaration

class func writeJSONObject(_ obj: Any, to stream: OutputStream, options opt: JSONSerialization.WritingOptions = [], error: NSErrorPointer) -> Int

Parameters

obj

The object to write to stream.

stream

The stream to which to write.

The stream should be opened and configured.

options

Options for writing the JSON data.

See JSONSerialization.WritingOptions for possible values.

Return Value

The number of bytes written to the stream, or 0 if an error occurs.

See Also

Creating JSON Data

class func isValidJSONObject(Any)

Returns a Boolean value that indicates whether a given object can be converted to JSON data.