The %FromJSONFile(file) method does not take a %File object as an argument but instead takes a string containing the name of file. You need to replace
set newObject = {}.%FromJSONFile(file)
with one of
set newObject = {}.%FromJSONFile("/tmp/longObjectFile.txt")
set newObject = {}.%FromJSON(file)
Originally, %FromJSON(input) would accept the 'input' argument as a %File object, a %Stream object, a JSON text string or a filename text string. However, accepting an argument string as either JSON or a filename was considered to be security issue because a malicious user could be requested to enter a json-string but, being malicious, the user would instead enter a filename-string, or vice-versa. As a result %FromJSON no longer accepts filename strings while %FromJSONFile only accepts filename strings.
No longer an issue, but it would be possible that legal VMS filename syntax could also be legal JSON text string syntax and such an argument string might be ambiguous on a VMS system. But IRIS no longer supports VMS and Caché for VMS did not support Dynamic Objects.
- Log in to post comments