JSONPrimitive.GetSource Method
Generates JSON string from the JSON object model. All parameters of this function are optional.

GetSource(
compact
as Boolean,
indent
as UInt8,
doublePrecision
as UInt8,
ensureASCII
as Boolean,
sortKeys
as Boolean,
encodeAny
as Boolean,
escapeSlash
as Boolean,
embed
as Boolean)
as String
Parameters
- compact
- Optional parameter - Default value = false.
Enables when set to true a compact representation, i.e. sets the separator between array and object items to "," and between object keys and values to ":". Without this flag, the corresponding separators are ", " and ": " for more readable output. - indent
- Optional parameter - Default value = 4.
Pretty-print the result, using newlines between array and object items, and indenting with n spaces. The valid range for indent is between 0 and 31 (inclusive), other values result in an undefined output. - doublePrecision
- Optional parameter - Default value = 17.
Output all real numbers with at most doublePrecision digits of precision. The valid range for doublePrecision is between 0 and 31 (inclusive), and other values result in an undefined behaviour.
By default, the precision is 17, to correctly and without loss will encode all IEEE 754 double precision floating point numbers. - ensureASCII
- Optional parameter - Default value = false.
If this parameter is is set to true, the output is guaranteed to consist only of ASCII characters. This is achieved by escaping all Unicode characters outside the ASCII range. - sortKeys
- Optional parameter - Default value = false.
If this parameter is set to true, all the objects in output are sorted by key. This is useful e.g. if two JSON texts are diffed or visually compared. - encodeAny
- Optional parameter - Default value = false.
Setting this parameter to true makes it possible to encode any JSON value on its own. Without it, only objects and arrays can be passed as the json value to the encoding functions.
Note: Encoding any value may be useful in some scenarios, but it’s generally discouraged as it violates strict compatibility with RFC 4627. If you use this flag, don’t expect interoperability with other JSON systems. - escapeSlash
- Optional parameter - Default value = false.
Escapes when set to true the / characters in strings with \/ - embed
- Optional parameter - Default value = false.
If this parameter is set to true, the opening and closing characters of the top-level array (‘[‘, ‘]’) or object (‘{‘, ‘}’) are omitted during encoding. This flag is useful when concatenating multiple arrays or objects into a stream.
Returns
- String
Remarks
See Also
JSONPrimitive Class