Skip to main content

Hi All,

I’m using the JSONTemplater and I am getting the following errors from FME when it parses the root template:

JSONTemplater (XMLTemplaterFactory): The following error occurred near line 81, column 59 of the query:
JSONTemplater (XMLTemplaterFactory): "fme.get-attribute": function with arity 1 not declared

In the root template, I have the following starting on line 80:

    "Subfeature1Array": [
    fme:process-features("Subfeature-First", "xxxNumber", fme.get-attribute("xxxNumber"))
    ],
    "Subfeature2Array": [
    fme:process-features("SecondFt", "xxxNumber", fme.get-attribute("xxxNumber"))
    ],
    "Subfeature3Array": [
    fme:process-features("ThirdFeat", "xxxNumber", fme.get-attribute("xxxNumber"))
    ]

Both the root features and the sub-features have an xxxNumber attribute.  I am following what is documented in the Help for the JSONTemplater “Selecting the Sub-Features to Process” section example but have no clue what the issue is.

 

Any help would be greatly appreciated!

<sigh>  Nevermind… I just realized that somewhere along the way the colon that comes after fme got changed to a period.  <head slap>


Are you perhaps able to share images of the JSON Templater X query for the root and sub templates. Im new to this and interested!


Disclaimer: This was my first experience using FME to work with JSON, so I am not sure what I’ve done is necessarily the best approach.

 

So I used the JSONFlattener to break out the properties of the JSON root node for the root template.  I used the JSONExtractor to break out the sub-nodes in my JSON that would be used for the sub-templates.  I then used a JSONFragmenter to break out the properties of each node.

Given a JSON file that starts like this:

{

   “property1” : “value”,

   “property2” : [

    {

       “property3” : “value”

    }]

}

The JSON XQueries I used for the JSONExtractor were like the following:

json[“property1”]

json[“property2”]

 

The JSON XQueries I used for the JSONFragmenter was simply json[*].

In the JSONFragmenters, I specified the property names I wanted to expose in the output for each JSONFragmenter.

 

For the JSONTemplater, I had the output from the JSONFlattener providing the JSON for the root template and the output from each of the JSONFragmenters providing the JSON for each of the sub-templates.  I created JSON files for each of the templates.  The following is an excerpt from one of those templates:

"Address": {
  "BuildingUnitIdentifier": fme:get-attribute("Owner.Address.ApartmentNumber"),
  "CivicSiteStreetNumber": fme:get-attribute("Owner.Address.BuildingNumber"),
  "CivicSiteStNoSuffix": fme:get-attribute("Owner.Address.BuildingNumberSuffix"),
 

I hope this helps you.