Class TokenToJSON

    • Method Detail

      • constructJSON

        public static java.lang.String constructJSON​(Token input)
                                              throws IllegalActionException
        Construct a string that represents the argument in JSON format. If the argument is a RecordToken, then a JSON object is returned (a string that starts with '{' and ends with '}'). If the argument is an ArrayToken, then a JSON array is returned (a string that starts with '[' and ends with ']'). In both cases, the contents of the record and array are constructed recursively. If the argument is any of the ScalarTokens, then a string representation of the number or boolean is returned. If the argument is null or a nil token, then the string "null" is returned. If the argument is a StringToken, return its value (with quotation marks). If the argument is a MatrixToken, then the matrix is represented as a JSON array with the elements in row-scanned order (raster scan).
        Parameters:
        input - Data to represent in JSON.
        Returns:
        a string that represent the input in JSON format
        Throws:
        IllegalActionException - If the Token found on the input cannot be expressed in JSON format