ToString - Maple Help

Online Help

All Products    Maple    MapleSim


JSON

  

ToString

  

format expression as JSON string

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ToString(data,opts)

Parameters

data

-

expression; data to be encoded as JSON

opts

-

(optional) options as specified below

Options

• 

style = one of block or inline.

  

Specifies whether structured objects in Maple should be to multi-line (block) or single-line (inline) output in JSON.

  

For example, if style=block a Maple list of three integers will produce a five-line JSON expression, while style=inline will produce a comma-delimited list on a single line.

Description

• 

The ToString(data) command formats the expression data as JSON (stored as a Maple string).

• 

The input data must be a structured expression made only using the base types string, truefalse, realcons, and extended_numeric and the container types list, rtable, table, record, set(equation), DataSeries, and DataFrame.

Examples

withJSON:

ToStringtablefruit=orange,count=23

[{"count": 23, "fruit": "orange"}]

(1)

ToStringa=b,c=6.283185308

{"a": "b", "c": 6.283185308}

(2)

Compatibility

• 

The JSON[ToString] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The JSON[ToString] command was updated in Maple 2020.

See Also

JSON

JSON[ParseString]