Skip to main content
Question

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

  • December 23, 2022
  • 4 replies
  • 42 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+21
  • Safer
  • 648 replies
  • 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
  • 16 replies
  • January 9, 2023

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+44
  • Influencer
  • 3422 replies
  • January 9, 2023

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
  • 16 replies
  • 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