JSONFragmenter

Extracts portions of JSON (JavaScript Object Notation) formatted text into new FME features.  

Output Ports

Parameters

Source

General

Flattening

JSON Queries

A JSON query is a simple mechanism to refer to values within a JSON document. A query is made up of one or more expressions, which are separated by a + operator. There are three types of expressions: JSON structure expressions, JSON property expressions and string literal expressions.

JSON Structure Expressions

A JSON structure expression can refer to values in a JSON document. The outermost JSON element, which must be an array or an object, is always referred to by the term json, and this term must appear at the beginning of every JSON structure expression. The child elements can be referred to using JavaScript-like square bracket index operators. For example, if the outermost element is an array, the first element of the array can be referred to by the expression json[0], the second element can be referred to by the expression json[1], and so on. Likewise, if the outermost JSON element is an object, with keys "name" and "address", then the values of these keys can be referred to by the expressions json["name"] and json["address"] respectively.

These index operators can be cascaded. For example, it the outermost JSON element is an object with a key and "address" whose value is an object containing keys "city" and "province", then these values can be referred to by the expressions json["address"]["city"] and json["address"]["province"].

In order to refer to all of the values in an array or object, a wildcard index * can be used. For example, if the outermost JSON element is an array, then the expression json[*] refers to every element in the array.

JSON Property Expressions

A property expression is a structure expression as described above, followed by a . (dot) operator and a property name. Currently, the only supported properties are type and size. The type property returns the type of the JSON value referred to by the JSON structure expression. For example, if the outermost JSON element is an array, and the first element of the array is a string, then the expression json[0].type would have a value of string. The size property, which can only be applied to an array, returns the number of elements in the array.

String Literal Expressions

A string literal expression is simply a quoted string value, such as "this is a string literal expression".

Editing Transformer Parameters

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.

Defining Values

There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.

Dialog Options - Tables

Transformers with table-style parameters have additional tools for populating and manipulating values.

FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

Search for samples and information about this transformer on the FME Community.

Keywords: JSONExploder