Skip to main content

system.mes.material.exportAsJson

Description

No Parameter:

Exports all Materials and Material Classes as raw JSON bytes (UTF-8 encoded). Streams material data from the database and formats it as JSON, including a header row.

With a Parameter:

Exports selected Materials and Material Classes by ids or paths as raw JSON bytes (UTF-8 encoded). Streams material data from the database and formats it as JSON, including a header row.

Syntax

system.mes.material.exportAsJson()
system.mes.material.exportAsJson(idsOrPaths)

Parameters

No Parameter:

ParameterTypeNullableDescription
None--This method does not take any parameters.

With a Parameter:

ParameterTypeNullableDescription
idsOrPathsPyListTrueList of material ids or paths to export only.

Returns

A Byte array (Byte[]) containing the raw byte data of the JSON export.

Code Examples

Perspective

jsonBytes = system.mes.material.exportAsJson()
system.perspective.download("materials.json", jsonBytes)

Script Console

jsonBytes = system.mes.material.exportAsJson()
path = system.file.saveFile("materials.json")
if path is not None:
system.file.writeFile(path, jsonBytes)