Barvna shema: Riviera
Trenutno dejavna stran: start » en » Documentation » Microsoft Access development tools » WKL Office JSON » WKL Office JSON troubleshooting » LoadJson returns False for JSON that other tools accept

LoadJson returns False for JSON that other tools accept

LoadJson or Load returns False for a configuration file or a service response that a text editor, a browser or a JavaScript library reads without complaint. ParseError.Reason names an unexpected character such as /, a comma after the last entry, or single quotation marks.

Environment

All versions of WKL Office JSON.

Cause

WKL Office JSON reads strict JSON as defined in RFC 8259. Comments (//, /* */), a comma after the last element ([1, 2,]), single-quoted strings ('text') and unquoted keys are not JSON; tools that accept them use a lenient dialect (JSON5, JavaScript object literals). A lenient mode is deliberately not implemented, because it would accept input that other JSON consumers reject.

Resolution

  1. Read ParseError.Line, LinePos and SrcText to find the position (how-to).
  2. Fix the source: remove comments and trailing commas, use double quotes.
  3. For files you do not control, remove full-line comments before loading, for example by skipping lines that start with // after trimming. Do not remove // inside lines: it can be part of a string such as a URL.
en/wiki/msaccess/json/troubleshooting/lenient-json-rejected.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille