Farbschema: Dunkel
Sie befinden sich hier: start » en » Documentation » Microsoft Access development tools » WKL Office JSON » WKL Office JSON troubleshooting » A getter raises jeTypeMismatch

A getter raises jeTypeMismatch

GetLong, GetCurrency, GetDate or another getter raises the error jeTypeMismatch (vbObjectError + 516), although the path exists, or even though a default was given.

Environment

All versions of WKL Office JSON.

Cause

The getters convert the value found by the path and refuse values that do not fit, instead of truncating them or returning the default:

  • GetLong for a number with a fraction (2.5) or outside the Long range.
  • GetDate for a string that is not ISO 8601 (RFC 3339 profile) (25.09.2026).
  • GetBoolean for a string other than "true" or "false" (compared in any case, spaces around it ignored; numbers are accepted: a number that is 0 after the conversion to Decimal is False).
  • GetDouble, GetCurrency or GetDecimal for a number outside the range of the type.
  • A number getter for a string that is not a JSON number ("12,5", "007", "+5").
  • GetDate for a number (for example a Unix timestamp).
  • A default that does not convert to the getter's type (GetLong(path, "abc")).
  • Any getter without a default for JSON null.

The default replaces only a missing path or null. A value of the wrong type stays an error, because silently substituting the default would hide a data problem.

Resolution

  1. Check the value: Debug.Print doc.SelectSingleNode(path).ToJson.
  2. Use the getter that matches the data: GetDouble or GetDecimal for fractions, GetString for dates in other formats (then convert with CDate under your own rules).
  3. For fields that may be null, pass a default, for example GetLong("$.qty", 0).
en/wiki/msaccess/json/troubleshooting/getter-type-mismatch.txt · Zuletzt geändert: von Wolfgang van der Stille