How can I create a JSON with the object ID by using the %Object:$toJSON API?
I have the following piece of code bellow where I create an object reference, create a %Object instance from %fromObject and them I am creating the JSON from $toJSON, but it does not expose the %ID (object id). How is the best approach to create a JSON with the respectives object IDs?
Try
{
Set tPersonObj = ##class(Data.Person).%OpenId(pId)
If $Get(%objlasterror) $$$ThrowStatus(%objlasterror)
Set tObj = ##class(%Object).$fromObject(tPersonObj)
Write tObj.

