JSON Parser Xojo plugin |

# JSONPrimitive.Parse Method

Parses JSON string.

shared Parse(
source as String,
rejectDuplicates as Boolean,
disableEOFCheck as Boolean,
decodeAny as Boolean,
decodeIntAsReal as Boolean,
allowNull as Boolean) as JSONParseResult

#### Parameters

source
  The string to be parsed.
rejectDuplicates
  Optional parameter - Default value = false
  Issue a decoding error when set to true if any JSON object in the input text contains duplicate keys. Without this flag, the value of the last occurrence of each key ends up in the result. Key equivalence is checked byte-by-byte, without special Unicode comparison algorithms.
disableEOFCheck
  Optional parameter - Default value = false
  By default, the decoder expects that it’s whole input constitutes a valid JSON text, and issues an error if there’s extra data after the otherwise valid JSON input. With this flag enabled, the decoder stops after decoding a valid JSON array or object, and thus allows extra data after the JSON text.
  Normally, reading will stop when the last ] or } in the JSON input is encountered. If both disalbeEOFCheck and decodeAny parameters are set to true, the decoder may read one extra UTF-8 code unit (up to 4 bytes of input). For example, decoding 4true correctly decodes the integer 4, but also reads the t. For this reason, if reading multiple consecutive values that are not arrays or objects, they should be separated by at least one whitespace character.
decodeAny
  Optional parameter - Default value = false
  By default, the decoder expects an array or object as the input. With this flag enabled, the decoder accepts any valid JSON value.
  Note: Decoding 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.
decodeIntAsReal
  Optional parameter - Default value = false
  JSON defines only one number type. This library distinguishes between ints and reals. With this flag enabled the decoder interprets all numbers as real values. Integers that do not have an exact double representation will silently result in a loss of precision. Integers that cause a double overflow will cause an error.
allowNull
  Optional parameter - Default value = false
  Allow \u0000 escape inside string values. This is a safety measure; If you know your input can contain null bytes, use this flag. If you don’t use this flag, you don’t have to worry about null bytes inside strings.
  Object keys cannot have embedded null bytes even if this flag is used.

#### Returns

JSONParseResult
  A JSONParseResult object which can contain the parsed structure or error codes and debug information.

#### Remarks

#### See Also

JSONPrimitive Class