PlanetCache/CacheJSON

Error encoding objects with custom objects as properties

Closed this issue · 1 comments

Getting a zEncode+11^CacheJSON error trying to encode Sample.Person object that contains properties for Home and Office of type Sample.Address. Extending CacheJSON on the Address class results in a similar error. This checking for custom object properties may need to occur inside the Encode() method.

Set list = ##class(%ListOfDataTypes).%New()
For x=1:1:size {
    Set obj = ##class(Sample.Person).%OpenId(x)
    Set sc = list.Insert(obj.GetAsArrayOfDataTypes())
}
Set encodedList = ##class(Sample.Person).Encode(list)
W !, !, "Encoded list of objects: " _ encodedList
Quit
uvg commented

Look at the bug fix in the pull requests