JSON (JavaScript Object Notation) Reader Parameters
Schema Scan
Auto: The reader will examine the JSON dataset and decide how to produce features. If the dataset is a JSON array, the reader will produce a feature for each value in the array. If the dataset is a JSON object, the reader will produce a single feature whose attributes are created from the object keys.
JSON Query: Selecting this option enables the JSON Query for Feature Objects parameter, where you can indicate which JSON values should be converted into FME features.
Identifies values in the JSON document that should be converted into FME features. The value of this parameter is a simple query string that refers to values in the JSON document.
Click the Browse button to open the dialog for this parameter. A tree structure represents the structure of the JSON dataset. Selecting a value from the tree will populate the parameter with the appropriate query string to turn the selected values into features.
The query string may also be manually entered. The string uses a simple syntax to refer to values in the JSON dataset. 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 query 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, if the outermost JSON element is an object with an "address" key 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.
This parameter controls whether or not the reader should flatten nested JSON objects and arrays into multiple attributes, or keep them as JSON values. This option provides similar functionality to the JSONFlattener transformer.
For example, consider the following JSON:
{ "id" : 456, "name" : { "first" : "Francisca", "last" : "Mitchell" } }
When the parameter is set to Yes, this will become a single feature with attributes named id, name.first, and name.second.
Attribute(64 bit integer) : 'id' has value '456'
Attribute(encoded: utf-8) : 'name.first' has value 'Francisca'
Attribute(encoded: utf-8) : 'name.last' has value 'Mitchell'
Nested objects will be flattened into attributes, with the key names separated by a ‘.’ character. Nested array values will be flattened into list attributes.
When the parameter is set to No, the attributes will be id and name. The name attribute will have a string value containing a JSON object, the value of the ‘name’ key.
Attribute(64 bit integer) : `id' has value `456'
Attribute(encoded: utf-8) : `name' has value `{"first":"Francisca","last":"Mitchell"}'
Feature Parameters
Specifies the JSON object key that contains the feature type of the FME feature produced from the object.
If no value is provided, json_featuretype is used.
Specifies the geometry format that the reader should use when converting the value of Geometry Key Name into FME geometry.
Possible values are GeoJSON, OGC-WKT, and None. If no value is provided, GeoJSON is used.
Specifies the JSON object key that contains the geometry of the FME feature produced from the object. If no value is provided, json_geometry is used.
Specifies the JSON object key that contains the coordinate system. The default value is json_ogc_wkt_crs
.
Note: FME supports features without a coordinate system assigned to them. If a coordinate system is specified for the reader in FME Workbench that differs from one specified in the reader dataset, the coordinate system specified in Workbench overrides the one specified in the dataset.
Yes: Each feature produced by the reader will contain a json_fragment attribute. This attribute will contain the entire JSON object or array from which the feature was created.
Schema Attributes
Use this parameter to expose Format Attributes in Workbench when you create a workspace:
- In a dynamic scenario, it means these attributes can be passed to the output dataset at runtime.
- In a non-dynamic scenario where you have multiple feature types, it is convenient to expose additional attributes using this one parameter. For example, if you have ten feature types and want to expose the same attribute in each one, it is easier to define it once than it is to set each feature type individually in the workspace.
Using the minimum and maximum x and y parameters, define a bounding box that will be used to filter the input features. Only features that intersect with the bounding box are returned.
If all four coordinates of the search envelope are specified as 0, the search envelope will be disabled.
When selected, this parameter removes any portions of imported features being read that are outside the Search Envelope.
The example below illustrates the results of the Search Envelope when Clip to Search Envelope is not selected (set to No) and when it is selected (set to Yes).
- No: Any features that cross the search envelope boundary will be read, including the portion that lies outside of the boundary.
- Yes: Any features that cross the search envelope boundary will be clipped at the boundary, and only the portion that lies inside the boundary will be read. The underlying function for the Clip to Search Envelope function is an intersection; however, when Clip to Search Envelope is selected, a clipping operation is also performed in addition to the intersection.
Use Network Authentication
This parameter is always visible in some formats, and visible in other formats only when the dataset is a URL.
Specify the authentication method to use when accessing a password-protected server.
- Basic: (default) Basic access authentication is designed to allow a client to provide credentials to a server on the assumption that the connection between them is trusted and secure. Note that any credentials passed from client to server can be easily intercepted through an insecure connection.
- Digest: Digest authentication is one of the agreed-upon methods a web server can use to negotiate credentials, such as username or password, with a user's web browser.
- NTLM: A challenge-response protocol that is used to provide compatibility with versions of Windows earlier than the Windows 2000 operating systems.
- Web Connection: Web connections provide a convenient and secure way to store and reuse previously established connection parameters. See Web Connection below.
- Single Sign-on: FME will use the credentials of the current user to authenticate the HTTP request. This authentication method currently works only on the Windows operating system.
Note: To access datasets using a proxy server, use the Network tools in FME Options. From the Workbench menu, select Tools > FME Options > Network. For more information, see "Network Proxy" in the FME Workbench Help.