Initializing help system before first use

jsonwrite

Purpose
Generate a JSON representation of a Mosel entity.
Synopsis
procedure jsonwrite(fname:text|string, mosobj:*)
procedure jsonwrite(fname:text|string, mosobj:*, flags:integer)
Arguments
fname 
Name of a file to store the generated text
mosobj 
A Mosel entity
flags 
Option flags (can be combined with '+'):
HTTP_SKIP_EMPTYCOL 
Skip empty collections in records
HTTP_SKIP_EMPTYUNION 
Skip empty unions in records
Further information
1. This procedure generates a JSON representation of a Mosel entity: records are exposed as json objects; lists and sets are represented by json arrays; arrays result in either json objects or arrays depending on their structure and scalar values are output as json numbers, Booleans or strings. Types not supporting serialisation ( i.e. conversion from/to some textual representation) are reported as the null json value.
2. When exporting a record, only public fields of types supporting serialisation are output: for instance a field of type mpvar will be silently ignored. With the flag HTTP_SKIP_EMPTYCOL empty collections (list,set or array) will also be skipped, and with the option HTTP_SKIP_EMPTYUNION undefined unions will be ignored.
3. If the file name is an empty string, the generated text is sent to the current output stream (by default this is the console). An IO error will be raised if the destination file cannot be accessed.
Related topics
Module

© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.