Some help with xojo.Core.InvalidArgumentException

I’m trying to serialize a BIG tree of classes with Kims excellent Serializer_MTC but I just can’t get Xojo to generate the JSON from the returned dictionary. It consists of about 20 classes, each having about 10 dictionary and array properties (where the elements are also classes, having their own dictionary and array properties, and so on…)

Is there some way to get some more info than the cryptic message I get from Xojo?

root{?}{?}{?}{?}[0]{?}{?}{?}{?}[0]{?}{?}{?}{?}[5]: String value is not convertible to UTF-8.

I know it is probably an empty String somewhere, but as this message suggests it somewhere very deep in the tree and after spending already a couple of hours trying to find the beast, I’m desperate.

From what I can tell from this message it must be something like:

Root class
Some dictionary item
– Some dictionary item
----- Some dictionery item
-------- Some dictionery item
----------- Array element 0
--------------- Some dictionary item
------------------ Some dictionary item
--------------------- Some dictionary item
------------------------ Some dictionary item
--------------------------- Array element 0
------------------------------- Some dictionary item
---------------------------------- Some dictionary item
-------------------------------------- Some dictionary item
------------------------------------------ Some dictionary item
---------------------------------------------- Array element 5 <-------- this element is an empty string

Is it somehow possible at least to know what the key value of the dictionary items is, e.g. instead of the question mark?

Note that converting Strings to Texts is not a possibility. This project is huge and until Xojo has the new framework everywhere, we’re not going to convert it.

I was hoping Kims JSONItem_MTC could also generate JSON from a dictionary but I fail to find how. Maybe I’m missing something? That way, I could at least put some stops in the conversion to find where it goes wrong.

The question marks mean that the code that generates this debug path in the exception doesn’t have a Text key. It seems like it could be taught about String keys.

In the meantime, you could implement a function of your own that recurses through the dictionaries and arrays to perform your own validation to find where it is.

I fear this is indeed my only possibility for now. I’ll see if I can rework Kims framework, as this already goes thru all the objects.