ObjFW
Instance Methods | Properties | List of all members
<OFJSONRepresentation> Protocol Reference

A protocol implemented by classes that support encoding to a JSON representation. More...

#import <OFJSONRepresentation.h>

Inheritance diagram for <OFJSONRepresentation>:
Inheritance graph
[legend]
Collaboration diagram for <OFJSONRepresentation>:
Collaboration graph
[legend]

Instance Methods

(OFString *) - JSONRepresentationWithOptions:
 Returns the JSON representation of the object as a string. More...
 

Properties

OFStringJSONRepresentation
 The JSON representation of the object as a string.
 

Detailed Description

A protocol implemented by classes that support encoding to a JSON representation.

OFJSONRepresentation.h ObjFW/OFJSONRepresentation.h

Warning
Although this method can be called directly on classes other than OFArray and OFDictionary, this will generate invalid JSON, as JSON requires all data to be encapsulated in an array or a dictionary!

Method Documentation

◆ JSONRepresentationWithOptions:

- (OFString *) JSONRepresentationWithOptions: (int)  options

Returns the JSON representation of the object as a string.

Parameters
optionsThe options to use when creating a JSON representation.
Possible values are:
Value Description
OF_JSON_REPRESENTATION_PRETTY Optimize for readability
OF_JSON_REPRESENTATION_JSON5 Generate JSON5
Returns
The JSON representation of the object as a string

The documentation for this protocol was generated from the following file: