libplist  2.8.0
API Documentation - Return to Homepage

◆ plist_to_json_with_options()

PLIST_API plist_err_t plist_to_json_with_options ( plist_t plist,
char ** plist_json,
uint32_t * length,
plist_write_options_t options )

Export the plist_t structure to JSON format with extended options.

When PLIST_OPT_COMPACT is set in options, the resulting JSON will be non-prettified.

When PLIST_OPT_COERCE is set in options, plist types that have no native JSON representation are converted to JSON-compatible types instead of returning PLIST_ERR_FORMAT:

Parameters
plistthe root node to export
plist_jsona pointer to a char* buffer. This function allocates the memory, caller is responsible for freeing it.
lengtha pointer to an uint32_t variable. Represents the length of the allocated buffer.
optionsOne or more bitwise ORed values of plist_write_options_t.
Returns
PLIST_ERR_SUCCESS on success or a plist_err_t on failure
Note
Use plist_mem_free() to free the allocated memory.