ParseString - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

• 

array : list or Array

  

Specifies the data struscture to use for parsed data corresponding to YAML arrays (sequential data delimited with square brackets). With array=list (the default), a YAML array is encoded as a list; with array=Array, it is encoded as an Array.

• 

object : one of equationset, DataSeries, record, or table

  

Specifies the data structure to use for parsed data corresponding to YAML objects (collections of key/value pairs delimited with curly braces).

  

With object=table (the default), an object is encoded as table; with object=record, it is encoded as a record; with object=DataSeries, it is encoded as a DataSeries.

• 

output : one of equationset, DataSeries, record, or table

  

A legacy alias for the object option.

Description

• 

ParseString(yamlString) 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.

• 

The YAML[ParseString] command was updated in Maple 2022.

• 

The array and object options were introduced in Maple 2022.

• 

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

See Also

YAML

YAML[ParseFile]

YAML[ToString]