Skip to main content
Version: V2 (Ignition 8.1)

system.mes.unitOfMeasure.exportAsJson

Description

Exports all or selected units of measure as raw bytes in JSON format (UTF-8 encoded). Streams UoM data from the database and formats it as JSON, where each object corresponds to a UnitOfMeasureImportDTO. When idsOrPaths is omitted, all units of measure are exported.

Permissions

This method requires the UNIT_OF_MEASURE.READ.GET permission.

Syntax

system.mes.unitOfMeasure.exportAsJson()
system.mes.unitOfMeasure.exportAsJson(idsOrPaths=["Kilogram"])

Parameters

ParameterTypeNullableDescription
idsOrPathsString[]YesThe ids or paths of the units of measure to export. Omit to export all.

Returns

A byte array (byte[]) containing the raw byte data of the JSON export (UTF-8 encoded).

Code Examples

Perspective

jsonBytes = system.mes.unitOfMeasure.exportAsJson()
system.perspective.download("units-of-measure.json", jsonBytes)

Script Console

jsonBytes = system.mes.unitOfMeasure.exportAsJson()
path = system.file.saveFile("units-of-measure.json")
if path is not None:
system.file.writeFile(path, jsonBytes)