Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 1.41 KB

File metadata and controls

25 lines (15 loc) · 1.41 KB

JSON_Generate

json_plus::JSON_Generate(json_root, format)

Create a JSON string from a node tree.

json_root
The root JSON node. This can be an object or array node.

format
A string with parameters to format the JSON string in a human readable way, styling it as desired. It's an ASCII only string and does not support Unicode characters.

If the 1st character in the format string is c special characters in strings are escaped and converted to their visual representation, JSON editors should use this option. Otherwise, special characters in strings are only escaped and NOT converted to their visual representation.

When the format string is parsed any line feed (0xA) characters before a JSON token are printed, any characters after the JSON token are printed until the string ends or the e character is encountered.

You can use the special p character to specify the number of key-value pairs to print on a single line. Characters after the number are printed until the string ends or the e character is encountered. Its recommended that the p option be the last parameter in the format string.

When a format string is used tab indentation is automatically turned on and activated by the { and } characters.

Return Value
A CHAR* JSON string, or NULL if the function fails.

Remarks
The JSON_OBJECT and JSON_ARRAY classes have a Encode member that calls this function.