The JSON Metadata and technology in Stambia offers the possibility to use 'Property Fields'.
A Property field is an internal field that can be added to the JSON Metadata and that allows to retrieve information such as the file name, path or size at read.
This functionality also permits to define dynamically the JSON nodes' name when writing a JSON file.
This is particularly useful when the name of the node is containing dynamic data information.
Prerequisites:
- Stambia DI Designer S18.3.0 or higher
- Stambia DI Runtime S17.4.0 or higher
Metadata Configuration
The Property Fields are added directly in the JSON Metadata.
The following Property Fields are available:
Property Name | Read | Write | Supported from Runtime Version | Description |
fileAbsolutePath | X | S17.4.0 | Absolute path of the file. | |
fileCanonicalPath | X | S17.4.0 | Canonical path of the file. | |
fileName | X | S17.4.0 | Name of the file. | |
fileParentName | X | S17.4.0 | Name of the folder containing the file. | |
fileParentPath | X | S17.4.0 | Path of the folder containing the file. | |
filePath | X | S17.4.0 | Path of the file. | |
fileSequenceNumber | X | S17.4.0 | Place of the file in the queue of found files. Useful in case of using file masks. | |
fileTotalSpace | X | S17.4.0 | Total disk space. | |
nodeAbsolutePosition | X | S20.4.2 |
Position of the current node which is incremented on each node. |
|
nodeLocalName | X | S17.4.0 | Name of the node. | |
nodeLocalPosition | X | S17.4.1 | Position of the current node in its parent | |
nodeName | X | S17.4.0 |
Name of the JSON node when writing a JSON File. This can be used to define dynamically the node name at execution. |
|
nodePath | X | S17.4.1 |
Path of the current node. For instance: /root[1]/customers[1]/e[1]/phones[1]/e[1] With [1] being the nodeLocalPosition |
|
nodeUUID | X | S20.4.2 | Generated identifier for each node when reading JSON data. |
Using the Property fields in a Mapping
Retrieving file information
Except the nodeName that is used only at write, all the other Property Fields can be used at read to retrieve the JSON file information.
Simply map the fields into a target database as usual.
Loading node's name dynamically
The nodeName Property Field allows to load dynamically the JSON nodes' name at execution.
For this, simply map this field when loading a JSON file.
The generated JSON file will look like this:
{
"json_person": {
"GIBBS": {
"id": 1,
"firstname": "Jason",
"lastname": "GIBBS",
"company": ""
}
}
}