Skip to main content
Version: V3 (Ignition 8.3)

system.mes.location.exportAsJson

Description

Exports all or selected Locations as a JSON string (UTF-8 encoded). Streams location data from the database and formats it as a JSON string, including a header row. When idsOrPaths is omitted, all locations are exported.

Permissions

This method requires the LOCATION.READ.GET permission.

Syntax

system.mes.location.exportAsJson()
system.mes.location.exportAsJson(idsOrPaths=["Enterprise/Site/Line1"])

Parameters

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

Returns

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

Code Examples

Perspective

jsonString = system.mes.location.exportAsJson()
system.perspective.download("locations.json", jsonBytes)

Script Console

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