YAML - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : MathML : YAML Package : YAML/ParseString

YAML

  

ParseString

  

parse a string containing YAML data

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ParseString(yamlString, opts)

Parameters

yamlString

-

string; YAML data

opts

-

(optional) options as specified below

Options

• 

output=name

either table, record, or DataSeries. Specifies the data structure to use for parsed data corresponding to YAML objects (collections of key/value pairs). With output=table (the default), an object is encoded as table; with output=record, it is encoded as a record; with output=DataSeries, it is encoded as a DataSeries.

Description

• 

The ParseString(yamlString) command parses the input string yamlString, which is assumed to be valid YAML.

Examples

Parse an input string to a Maple table

with(YAML):

data := ParseString("[{\"fruit\": \"orange\", \"count\": 23}]");

tablefruit=orange,count=23

(1)

data[1]["fruit"];

orange

(2)

Parse the same input string to a Maple record

dataRec := ParseString("[{\"fruit\": \"orange\", \"count\": 23}]",output=record);

Recordpackedfruit=orange,count=23

(3)

data[1]["fruit"];

orange

(4)

Compatibility

• 

The YAML[ParseString] command was introduced in Maple 2017.

• 

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

See Also

YAML

YAML[ParseFile]

YAML[ToString]