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) -> Bool

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software