You are here: JSON > JSONFragmenter

JSONFragmenter

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

Output Ports

Parameters

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".

FME Licensing Level

FME Professional edition and above

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.

Transformer Categories

JSON

Search FME Knowledge Center

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

Tags Keywords: JSONExploder