JSON - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : JSON : JSON/ParseFile

JSON

  

ParseFile

  

read JSON data from a file

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ParseFile(source, opts)

Parameters

source

-

string; file or URL to read from

options

-

options as specified below

Options

• 

output=name

either table, record, or DataSeries. Specifies the data structure to use for parsed data corresponding to JSON 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 ParseFile(source) command reads JSON data from the file or URL source.

  

If source is a file, it is closed after it is read.

Examples

Parse an input JSON file to a Maple table

addressFileTools:-JoinPathexample/address.json,base=datadir

address/usr/local/repository/build/rdgetroll1/maple/slot1/data/example/address.json

(1)

JSON:-ParseFileaddress

tablephoneNumbers=tablenumber=+1 (519) 747-2373,type=local,tablenumber=+1 (800) 267-6583,type=tollfree,tablenumber=+1 (519) 747-5284,type=fax,address=tableprovince=ON,streetAddress=615 Kumpf Drive,country=Canada,city=Waterloo,postalCode=N2V 1K8,companyName=Maplesoft,founded=1988

(2)

Parse the same input JSON file to a Maple record

JSON:-ParseFileaddress,output=record

Record[packed]phoneNumbers=Record[packed]...,Record[packed]...,Record[packed]...,address=Record[packed]...,companyName=Maplesoft,founded=1988

(3)

Compatibility

• 

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

• 

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

• 

The JSON[ParseFile] command was updated in Maple 2016.

See Also

JSON

JSON[ParseString]

JSON[ToString]