Skip to content

TSTool / Command / WriteObjectToJSON


Overview

The WriteObjectToJSON command writes an object to a JSON file. Any JSON object can be written, including objects read from GeoJSON files (for example using the NewObject command).

Command Editor

The command is available in the following TSTool menu:

  • Commands / Object Processing

The following dialog is used to edit the command and illustrates the command syntax.

WriteObjectToJSON command editor

WriteObjectToJSON Command Editor (see full-size image)

Command Syntax

The command syntax is as follows:

WriteObjectToJSON(Parameter="Value",...)

Command Parameters

Parameter                           Description Default                     
ObjectID
required
The object identifier for the object to be output. Can be specified using ${Property}. None - must be specified.
OutputFile
required
The name of the output file to write. Can be specified using ${Property}. None - must be specified.
PrettyPrint Whether to format the JSON in indented format, which is easier to read but results in larger files. True
Indent Used with PrettyPrint=True to indicate the number of spaces used for indentation. 2

Examples

See the automated tests.

Troubleshooting

Problems in JSON files can be checked by using online "JSON lint" websites.

See the main TSTool Troubleshooting documentation.

See Also