Skip to main content
Question

error message from Json template: invalid expression: syntax error, unexpected ":", expecting "," or ")"

  • December 23, 2022
  • 4 replies
  • 31 views

geomax
Contributor
Forum|alt.badge.img+3

Hello,

I am trying to create a Json schema using the Json Template but I receive the error: JSONTemplater_2 (XMLTemplaterFactory): The following error occurred near line 21, column 20 of the query:JSONTemplater_2 (XMLTemplaterFactory): invalid expression: syntax error, unexpected ":", expecting "," or ")"

JSONTemplater_2 (XMLTemplaterFactory): An error occurred while executing the 'PROPERTIES' query

JSONTemplater_2 (XMLTemplaterFactory): The following error occurred near line 6, column 9 of the query:

JSONTemplater_2 (XMLTemplaterFactory): An error occurred while executing the process-features function

If I validate my Json on line seems to be correct but in FME doesn't work.

Do you have some suggestion?

Attached the file that I am using

 

Thanks

Max

 

4 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • December 23, 2022

Hello @geomax​ 

You may have a typo on line 20 as the xs:int function is missing the closing parenthesis. Try adding another closing parenthesis to this line in the JSON template. For example, it should be:

"valueKph": xs:int(fme:get-attribute("speedlimit")),

 


geomax
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • January 9, 2023
debbiatsafe wrote:

Hello @geomax​ 

You may have a typo on line 20 as the xs:int function is missing the closing parenthesis. Try adding another closing parenthesis to this line in the JSON template. For example, it should be:

"valueKph": xs:int(fme:get-attribute("speedlimit")),

 

Hello @debbiatsafe​,

sorry for delay in my reply and thanks for your comment.

My field is already "string type" so how can I add something like "xs: .........." for string data type. I didn't find any example for it.

If I try something like "appliesTo": xs:string(fme:get-attribute("appliesTo")) doesn't work.

 

Thanks

 

Max

 


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • January 9, 2023
geomax wrote:

Hello @debbiatsafe​,

sorry for delay in my reply and thanks for your comment.

My field is already "string type" so how can I add something like "xs: .........." for string data type. I didn't find any example for it.

If I try something like "appliesTo": xs:string(fme:get-attribute("appliesTo")) doesn't work.

 

Thanks

 

Max

 

What are you trying to achieve? If your field is a string, it will be returned in quotes without the need for anything other than 

fme:get-attribute("appliesTo")

If you want to ensure it is a string if the data type is not a string then you can use xs:string


geomax
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • January 11, 2023

Hello,

my goal is to copy the values present in the field "AppliesTo" (shapefile format) in the same field present in the Json schema.

After a check, there was an error in the file and, after normalization, I applied what @debbiatsafe​ suggested.

 

Thanks to all.

Max

 


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