Skip to main content
Solved

Why does the JSONFragmenter not understand UserParameters?


tb09114
Supporter
Forum|alt.badge.img+22

I define a bounding box in JSON as UserParameter but when processing it, the JSONFragmenter fails when I refer to the UserParameter.

Simply converting the UserParameter to an attribute, and reading the attribute into the JSONFragmenter works!

 

There is no change to the JSON string done, and the source for the JSONFragmenter offers the use of UserParameters.

The documentation for the JSONFragmenter though is pointing at "any string expression, including attribute values and workspace parameters."

Best answer by david_r

Sounds like one of the few remaining places in FME that does not properly support referencing a parameter (rather than an attribute), consider flagging it as a possible bug with Safe Support.

View original
Did this help you find an answer to your question?

6 replies

david_r
Evangelist
  • Best Answer
  • October 2, 2023

Sounds like one of the few remaining places in FME that does not properly support referencing a parameter (rather than an attribute), consider flagging it as a possible bug with Safe Support.


virtualcitymatt
Celebrity
Forum|alt.badge.img+34

The thing is here the transformer is looking for an Attribute Name - you can have a published parameter with the name of the attribute. The Parameter in this case is just a pointer to the Attribute the transformer should look for.

 

In the log file you can see it's trying to look for an attribute with the name of your JSON. It doesn't find any attribute with that name.

 

If the Parameter has the value of the attribute name then it works (e..g, "_boundingbox")


tb09114
Supporter
Forum|alt.badge.img+22
  • Author
  • Supporter
  • October 2, 2023
virtualcitymatt wrote:

The thing is here the transformer is looking for an Attribute Name - you can have a published parameter with the name of the attribute. The Parameter in this case is just a pointer to the Attribute the transformer should look for.

 

In the log file you can see it's trying to look for an attribute with the name of your JSON. It doesn't find any attribute with that name.

 

If the Parameter has the value of the attribute name then it works (e..g, "_boundingbox")

I am aware of the source setting to "JSON Attribute". Yet, the documentation refers to any string expression, including attribute values and workspace parameters!

Adding an extra AttributeCreator or any other transformer for the sake of creating a link to a UserParameter should not be necessary according to the documentation, or the possibilities offered from within the JSONFragmenter settings dialog.


virtualcitymatt
Celebrity
Forum|alt.badge.img+34
tb09114 wrote:

I am aware of the source setting to "JSON Attribute". Yet, the documentation refers to any string expression, including attribute values and workspace parameters!

Adding an extra AttributeCreator or any other transformer for the sake of creating a link to a UserParameter should not be necessary according to the documentation, or the possibilities offered from within the JSONFragmenter settings dialog.

Ha - you're right. I just checked the doc and I think the doc is wrong here. Either that or the functionality is not expected. Certainly other JSON transformers support a "JSON Document" as input whereas this one says JSON Attriubte. I will then have to agree with @david_r​ and suggest you ask Safe.

 

Here is the FME 2021 doc:

imageand here is the FME 2022 doc:

imageMy guess is that the documentation was modified and that it was assume that this section applied to all JSON transformers.

 

I looked through the change logs of FME 2022 and couldn't see anything about the JSONFragmenter getting an upgrade.


tb09114
Supporter
Forum|alt.badge.img+22
  • Author
  • Supporter
  • October 2, 2023

Alright, flagged it as possible bug. Thanks for your comments.


natalieatsafe
Safer
Forum|alt.badge.img+11

@Thomas Becker​ Hi there, thanks for the question and the repro workspace. I took a peek at the JSONFragmenter_2 in your workspace, and I see that the User Parameter referenced for the JSON Attribute parameter of the transformer is a Geometry user parameter.

 

The issue at play here is that this JSON Attribute parameter requires a User Parameter of type Attribute Name in order to function correctly. It's looking to be pointed to an attribute containing the JSON text needed. A Geometry User Attribute is not formatted in a way that this JSON Attribute parameter can recognize and process.

 

A good way to check on the type of User Parameter that any given transformer parameter expects is to create the user parameter from within the transformer itself, rather than from the Manage User Parameters menu. As my own check, I made a copy of your JSONFragmenter_2, and then selected the drop-down next to its JSON Attribute parameter. I then chose the User Parameter option, and then Create User Parameter.

 

CreateUserParamInTransformer 

When I viewed this created User Parameter in Manage User Parameters, I noticed that the created User Parameter was of type Attribute Name.

 

DefaultParamNeeds 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings