Problem exporting %Library.DynamicObject to JSON with %JSON.Adaptor
Hello everyone,
I am using a class that inherits from %RegisteredObject
and %JSON.Adaptor
to generate a JSON string from its instances.
However, one of the properties in my class is of type %Library.DynamicObject
, as in the example:
Class Faces.Option Extends (%RegisteredObject, %JSON.Adaptor)
{
Property legend As %String;
Property xAxis As %Library.DynamicObject;
}
When calling %JSONExportToString()
on an object of this class, the JSON generated for the xAxis
property is incomplete or malformed. It seems the default %JSON.Adaptor
doesn't correctly handle properties of type %Library.DynamicObject
.
Example of the resulting JSON: {"legend":"test","xAxis": { ... (broken JSON) ...
Previously (in Caché 2018), I used %ZEN.proxyObject
for similar situations, but I need a solution for the current versions during migration.
Does anyone know how I can configure %JSON.Adaptor
to correctly serialize %Library.DynamicObject
properties, or what the recommended approach for this would be?
Thanks!