Skip to main content
Version: V2 (Ignition 8.1)

system.mes.operation.exportAsJson

Description​

Exports all Operations as raw bytes in JSON format (UTF-8 encoded). Streams operation data from the database and formats it as JSON, including a header row.

Permissions​

This method requires the OPERATION.READ.GET permission.

Syntax​

system.mes.operation.exportAsJson()
system.mes.operation.exportAsJson(locationIdsOrPaths)

Parameters​

Method 1: Export all operations​

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

Method 2: Export operations for specific locations​

ParameterTypeNullableDescription
locationIdsOrPathsString[]TrueThe IDs or paths of the locations to export operations for. If omitted, all operations are exported.

Returns​

All operations as a JSON string (UTF-8 encoded).

Code Examples​

Perspective​

jsonBytes = system.mes.operation.exportAsJsonBytes()
system.perspective.download("operations.json", jsonBytes)

Script Console​

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