Error

public enum Error: Swift.Error

Enumeration describing possible errors that occur while parsing a JSON document. Most errors include an associated offset, representing the offset into the UTF-8 characters making up the document where the error occurred.

  • The parser ran out of data prematurely. This usually means a value was not escaped, such as a string literal not ending with a double quote.

    Declaration

    Swift

    case endOfStreamUnexpected
  • Unexpected non-whitespace data was left around offset after parsing all valid JSON.

    Declaration

    Swift

    case endOfStreamGarbage(offset: Int)
  • Too many nested objects or arrays occured at the literal started around offset.

    Declaration

    Swift

    case exceededNestingLimit(offset: Int)
  • A character was not a valid start of a value around offset.

    Declaration

    Swift

    case valueInvalid(offset: Int, character: UnicodeScalar)
  • Badly-formed Unicode escape sequence at offset. A Unicode escape uses the text \u followed by 4 hex digits, such as \uF09F\uA684 to represent U+1F984, UNICORN FACE.

    Declaration

    Swift

    case unicodeEscapeInvalid(offset: Int)
  • Badly-formed control character around offset. JSON supports backslash-escaped double quotes, slashes, whitespace control codes, and Unicode escape sequences.

    Declaration

    Swift

    case controlCharacterUnrecognized(offset: Int)
  • Invalid token, expected null around offset

    Declaration

    Swift

    case literalNilMisspelled(offset: Int)
  • Invalid token, expected true around offset

    Declaration

    Swift

    case literalTrueMisspelled(offset: Int)
  • Invalid token, expected false around offset

    Declaration

    Swift

    case literalFalseMisspelled(offset: Int)
  • Badly-formed collection at given offset, expected , or :

    Declaration

    Swift

    case collectionMissingSeparator(offset: Int)
  • While parsing an object literal, a value was found without a key around offset. The start of a string literal was expected.

    Declaration

    Swift

    case dictionaryMissingKey(offset: Int)
  • Badly-formed number with no digits around offset. After a decimal point, a number must include some number of digits.

    Declaration

    Swift

    case numberMissingFractionalDigits(offset: Int)
  • Badly-formed number with symbols (- or e) but no following digits around offset.

    Declaration

    Swift

    case numberSymbolMissingDigits(offset: Int)