Reading JSON Array Input Data in Registers Gateway
- Last UpdatedAug 04, 2026
- 3 minute read
A schema defined on the Register data source definitions to read Json array type of data in the input file is as follows:
Example - JSON Template as part of Register Definition
<InfoInterface:Data_x0020_Sources geicl:id="Data Sources" xmlns="http://schemas.aveva.com/InformationInterfaces/Extension/Schema/2 017/04">
<Test nomenclature="MASTER" CaptureMethod="Full" CaptureExclude="{{ @Exclude.sanitise in ['y', 'yes'] }}" CaptureInclude="{{ @Include.sanitise in ['','y','yes'] }}">
<ue
registerType="attributes" category="tags"
JsonTemplate="{"~$Session":{},"Objects": [{"##":"tag","#@":{},"#
amp;quot;:{"?":"{{$[attr.name] not equals 'context'}} "},"Attributes":[{"#@":{"n":"
{{@Name}}","v":"{{@Value}} ","u":"{{@Units}}","?":"
{{@Value.isSet()}}"}}],"Associations": [{"~$Type":{},"Objects":[{"#@":
{"n":"{{$type}}","v":"
{{'|'.join(@Context, @ID)}}"}}]}]}]}" IDExpression="{{ $[this.id] }}" AttributeNameColumn="PROPERTY_NAME" AttributeValueColumn="PROPERTY_VALUE" AttributeUnitsColumn="PROPERTY_VALUE_UOM" captureColumns="true"
>
<Columns>
<TAG_NAME Description="{geicl:null}" />
<PROPERTY_NAME Description="{geicl:null}" />
<PROPERTY_VALUE Description="{geicl:null}" />
<PROPERTY_VALUE_UOM Description="{geicl:null}" />
<PLANT_CODE geicl:id="PLANT_CODE" Description="{geicl:null}" />
</Columns>
</ue>
</Test>
</InfoInterface:Data_x0020_Sources>
Language Syntax
This chapter discusses about language syntax such as attributes, variables, text, numbers and so on.
Syntax for Schema
The following are the syntax for schema while processing Json files.
%X : Preprocessing Substitution
|
% |
Description |
|
"%A" : "hello" |
%A% in processing instructions will be substituted with text hello. |
|
"%BCD" : "{{ $[attr.name] not starts ‘attr’ }}" |
%BCD% in processing instructions will be substituted with the expression text, however, the pre-processing will not evaluate the expression. |
~$ : Capture Reader Variables
|
{ "n":"…" , "v": "…" , "?": "…" } |
Description |
|
"~$" : {} |
Captures all fields from current Json object, and any nested objects without arrays that are not a defined structure element in the template into the reader. |
|
"~$session" : {} |
Captures the session property into a $session variable in the reader. |
|
"~$" : { "?" : "{{ $[attr.name] not starts ‘attr’ }}"} |
Captures all properties not starting with text attributes into variables with the same names as the properties into the reader. |
## : Set Object Template
|
{ "n":"…" , "?": "…" } |
Description |
Remarks |
|
"##" : "tag" |
Defines an object called tag. |
|
|
"##" : { "n":"tag", "?":"{{ @desc.isSet}}" } |
Defines an object called tag and only emit an object if the desc attribute is set |
A tag name may not be an expression |
#@ : Collect Object Attributes
|
{ "n":"…" , "v": "…" , "u": "…" , "?": "…" } |
Description |
|
"#@" : {} |
Collects all attributes from this object and any sub objects that are not part of explicit Json template structure |
|
"#@id" : {} |
Sets @id attribute from id field |
|
"#@1" : { "n":"{{$[attr.name]}}", "v":"{{$[attr.value]}}" } |
Collects all properties which have values of primitive fields, or array of primitives, to attributes |
|
"#@2" : { "n":"@name", "v":"{{@value}}", "u": "{{@units}}", "?":"{{@value.isSet}}"} |
Collects an object of properties into an attribute, but only if the @value is set |
|
"#@" : {"?":"{{$[attr.value].isSet}}"} |
Collects all properties into attributes where the value is set |
#$ : Collect Object Metadata
|
{ "n":"…" , "v": "…" , "u": "…" , "?": "…" } |
Description |
|
"#@" : {} |
Collects all attributes from this object and any sub objects that are not part of explicit Json template structure |
|
"#@id" : {} |
Sets @id attribute from id field |
|
"#@1" : { "n":"{{$[attr.name]}}", "v":"{{$[attr.value]}}" } |
Collects all properties which have values of primitive fields, or array of primitives, to attributes |
|
"#@2" : { "n":"@name", "v":"{{@value}}", "u": "{{@units}}", "?":"{{@value.isSet}}"} |
Collects an object of properties into an attribute, but only if the @value is set |
|
"#@" : {"?":"{{$[attr.value].isSet}}"} |
Collects all properties into attributes where the value is set |
Processing of JSON Array Data Using IED Gateway
The following example shows the processing of the JSON array type of data from the IED Gateway:
Schema Definition:
{
"#$Session": "{{@Session}}", "Objects": [
{
"##": "tag",
"Attributes": [
{
"#@": {"Name": "{{@Name}}", "Value": "{{@Value}}", "Units": "{{@Units}}" }
}
],
"Associations": [
{
"#$associationType" : "{{@Type}}", "Objects": [
{
"#@": { "Name": "{{$associationType}}", "Value":
"{{'|'.join(@Context, @ID)}}" }
}
]
}
]
}
]
}
This following data will be processed using the above schema
{
"Session": "25/11/2020 04:06:51",
"Objects": [
{
"Id": "=16385/5485",
"ClassId": "Pipe",
"Context": "PROJECTCONTEXT", "Name": "=16385/5485",
"Attributes": [
{
"Name": "Name", "Value": "=16385/5485"
},
{
"Name": "Description",
"Value": { "long" : "a long description", "short" : "a short desc"}
},
{
"Name": "Systems",
"Value": [10,20]
}
]
}
}
This will create a tag record attribute as shown below:
|
Attribut e |
Value |
Remarks |
|
Id |
=16385/5485 |
|
|
ClassId |
Pipe |
|
|
Context |
PROJECTCONTEXT |
|
|
Name |
=16385/5485 |
A string value (set twice as repeated) |
|
Descripti on |
{ \"long\" : \"a long description\", \"short\" : \"a short desc\"} |
A string value, being embedded JSON Text |
|
Systems |
[10,20] |
An array with 2 values |
Setting Conditions for Reading Attributes from Objects:
Example:
{
"##": "equi", "physicalEquipmentSpecifications": [
{
"##": 0,
"#@1": {
"Name": "{{@characteristicDescription}}", "Value": "{{@characteristicValue}}", "Units": "{{@characteristicUnitOfMeasure}}", "Where": "{{@processMode equals 1}}" },
"#@0": {
"Name": "Processs Mode 0",
"Value": "{{@characteristicValue}}", "Units": "{{@characteristicUnitOfMeasure}}", "Where": "{{@processMode equals 0}}" }
}
]
}