I need to convert a JSON payload to a custom object type. Currently, I'm converting the JSON object to a %Library.DynamicObject object and need to proceed from here. As of now, these are my options                  1. Using an external library talked about in this link:

https://community.intersystems.com/post/binding-regular-cache-object-dynamicobject-and-vice-versa

Downside: Could be buggy (as admitted by the creator) + some other design concerns brought up in its the discussion thread

 

2. Creating a new object of the desired class and then Iterating through the DynamicObject and populating the new object's fields.

Downside: Having to do this for each type of object individually rather than being able to generalize it (because of the need to instantiate new objects for swizzled objects)

Is there a standard way of doing this? IRIS for UNIX (Apple Mac OS X for x86-64) 2019.4.0DS (Build 165U)