Hi John,
In the same class %ZEN.Auxiliary.jsonProvider that you used for the JSON to Object version there is another method %ObjectToJSON which I believe is what you are looking for. This will write out the contents of object instance pObject to the current device using JSON notation.
Another slightly different option is to use the %DynamicAbstractObject class and methods %FromJSON which given a valid JSON string will parse it and return an object of datatype %DynamicAbstractObject and %ToJSON which will convert an instance of %DynamicAbstractObject into a JSON string.
Please note that the version of Documentation I consulted for these was Cache and Ensemble Version 2018.1.9
Another possible solution to this,
ClassMethod PadNumberWithZeros(number As %String, ln As %Integer) As %String
{
set num = number
while $length(num) < ln {
set num = "0" _ num
}
return num
}
Returns 0000025 for 25 and 0000009 for 9 for the provided test cases
Hi Alin,
Looking in the Caché & Ensemble 2018.1.4 – 2018.1.9 documentation there is a class %OAuth2.JWKS with method AddOct() for Cache almost identical to the one you described above for IRIS. This method is available for Cache 2018.1.9 the version you listed in your question. Hope this documentation helps.
For others reference w.r.t. IRIS, the method and class you described above are deprecated in later versions of IRIS and %Net.JSON.JWK or %Net.JSON.JWKS should be used instead.