Question

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

  • 23 December 2022
  • 4 replies
  • 5 views

Badge +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

Userlevel 3
Badge +17

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")),

 

Badge +3

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

 

Userlevel 1
Badge +21

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

Badge +3

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

 

Reply