Removing properties from a ZENProxyObject before it is returned by a REST service
Hi
I have been experimenting with the creation of a set of REST services for an app. The basic GET operation is set to create a %ZEN.proxyObject instance, and then set an instance of a Persistant class as a property, which gives me all of the values I want to return. However, it also gives me some values that I don't want to return over REST (because they are both private, and large registered objects which will bog down performance)
How do I remove these values from the ZENproxyObject? I can only see a full clear() in the documentation, but nothing which can remove individual elements
Thanks
Chris
By default %ToJSON method prints empty properties.
If you pass pFormat without "e" flags (that is passed by default), then empty properties are skipped:
I encourage you to use Caché 2016.1 with native JSON support. Don't start with %ZEN.proxyObject.
See great article by Stefan Wittman about JSON support in 2016.1:
https://community.intersystems.com/post/introducing-new-json-capabilitie...
There is also this way:
kill p.%data("b") would completely remove b property. But better use Caché 2016.1 with native JSON support.
Fantastic. Thank you both for your help. I will migrate over to using %Object instead