Barvna shema: Svetla
Trenutno dejavna stran: start » en » Documentation » Microsoft Access development tools » WKL Office JSON » WKL Office JSON troubleshooting » SetValue raises jeUnsupportedValue

SetValue raises jeUnsupportedValue

SetValue, Add, Insert or Value = … raises jeUnsupportedValue (vbObjectError + 520) when a Scripting.Dictionary, a Collection, a recordset or another object is passed.

Environment

All versions of WKL Office JSON.

Cause

Only values with a JSON form are accepted: String, the numeric types, Boolean, Date, Null, Empty and Nothing (written as null), one-dimensional arrays of these, and JSON nodes or a JDoc (Value = … of a value node takes no arrays and no nodes with children; those raise jeInvalidOperation there, see Values and limits). Foreign objects, including Scripting.Dictionary and Collection, and arrays with more than one dimension have no defined JSON form.

Resolution

  1. Build the structure with the library's own methods: AddElement for an object, AddArray for an array, SetValue for each member.
  2. Convert a dictionary in a loop:

    Dim target As JElement, key As Variant
    If doc.Root Is Nothing Then Set doc.Root = doc.CreateElement   ' a new JDoc is empty
    Set target = doc.Root
    For Each key In dict.Keys
        target.SetValue CStr(key), dict(key)
    Next
  3. Convert a two-dimensional array (for example from GetRows) row by row into objects of an array.
en/wiki/msaccess/json/troubleshooting/unsupported-value.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille