JSON (JavaScript Object Notation) Reader/Writer

FME can read and write data in the JSON (JavaScript Object Notation) format.

JSON is a simple structured text format. It is designed to be easy to script and read, and to be easily integrated into JavaScript applications. Like the GeoJSON (Geographic JavaScript Object Notation) Reader/Writer, spatial data in JSON is identified using key/value pairs. However, unlike GeoJSON, JSON does not define a standard schema of key names. This limitation makes JSON less suitable than GeoJSON for applications that retrieve spatial data from multiple sources.

JSON Product and System Requirements

Format

Platform

Operating System

Reader/Writer

FME Desktop License

FME Server

FME Cloud

Windows 64-bit

Linux

Mac

Reader

Available in FME Professional Edition and higher

Yes

Yes

Yes

Yes

Yes

Writer

Available in FME Professional Edition and higher

Yes

Yes

Yes

Yes

Yes

Overview of JSON Syntax

This section gives an overview of JSON syntax. For detailed information about the JSON format, see http://www.json.org.

JSON syntax uses objects and arrays.

A JSON object is a pair of braces containing key/value pairs separated by commas, with a colon between each key and value. Keys are an unordered set of strings; each key in an object is unique, and they can be specified in any order. An object can have any number of key/value pairs, including zero. A sample JSON object is:

Copy
{
    "key with string value”:"this is a string value",
    "key with exponential value":-59.45E-4,
    "key with null value":null,
    "key with boolean value":true,
    "key with array value":[ false, 12, 56.82, { “key”:"value" } ],
    "key with object value":{}

}
}

A JSON array is an ordered set of values separated by commas. A value can be an object, an array, a string, a number (integral, decimal, or exponential), a Boolean, or the literal value null. An array can have any number of values, including zero. A sample JSON array is:

Copy
[
    12,
    "a string value",
    56.3e6,
    null,
    false,
    [ 1, 2, 3, {} ]
]

Reader Overview

The JSON reader will convert a JSON document into one or more FME features. Reader parameters can be used to indicate which values are turned into FME features, and which attributes are created for those features.

The reader can create a feature from a JSON object or array. When converting an object into a feature, the object keys become feature attributes. It is also possible to specify which object key will contain a geometry value or a coordinate system value.

When converting an array into a feature, a new attribute will be created for each attribute in the array. These attributes will have generic names such as attribute0, attribute1, etc. The reader will not produce geometry or coordinate systems for these features.

Writer Overview

The JSON writer outputs features as an array of JSON objects.

You can specify the keys in the JSON object that contains the FME feature type and feature geometry. Feature attributes are written as key/value pairs in the JSON object.