Skip to main content
Question

JSON templater error


Forum|alt.badge.img
Hi everybody,

 

 

I have implemented a service that at the end creates a JSON. It works fine, but I have updated one of the custom transformers that I used. This custom transformer has minimal changes and the outputs are equal thans the previous version. But when I run the process, I get an error:

 

 

WARN |JSONTemplater(XMLTemplaterFactory): The following error occurred near line 212, column 71 of the query:

 

WARN |JSONTemplater(XMLTemplaterFactory): invalid expression: syntax error, unexpected ":", expecting "external" or ":="+

 

ERROR |JSONTemplater(XMLTemplaterFactory): An error occurred while parsing the ROOT template

 

 

I have been looking for something but I can`t see anything. I have a unique template (root). I can`t debug to see any problem.

 

 

If I use the previous custome transformer it works fine.

 

 

Thanks for your time!

11 replies

david_r
Celebrity
  • June 29, 2015
Hi

 

 

I suspect there is a syntax error in your JSONTemplater, possibly on line 211 or 212 ;-)

 

 

Sorry, it is near impossible to give you a more precise answer without more details...

 

 

Can you put your template on e.g. pastebin.com and post the link here?

 

 

David

Forum|alt.badge.img
Thanks David for your reply!

 

 

In the JSONTemplater, in the ROOT Template Expression  I only have 53 lines. That is the problem. In other cases that I have had a syntax error as you say I solved it with the error description... but in this case it it is meaningless.

 

 

I have tested the JSONTemplater with only one sentence and the error is equal. :S. So I'm testing again the outputs of the custom transformer outputs.

 

 

Thanks again!

Forum|alt.badge.img
I have identified the problem but I don't find a reason...

 

 

Originally in the custom transformer I have been using a private parameter in order to store a constant value. I retrieved the value with a ParameterFetcher transformer storing the value in a new attribute. Then, the attribute value was used in a temporal variable (VariableSetter transformer).

 

 

Now I don`t use a private parameter (therefore I do not use "ParameterFetcher") and I set manually the value in the VariableSetter transformer. When I use the custom transformer in the process that generate the json content, no errors are registered.

 

 

I do not know why, but it is a "solution"... The problem is that I use the same value in several VariableSetter transformers and if someday I have to change the value...

 

 

 

 

Forum|alt.badge.img
  • September 8, 2015
I'm having a similar problem with the FMEServerEmailGenerator. It works fine if you use a Creator but as soon as you add a reader (Oracle in this case) it fails with the invalid expression error. The reader is not even connected to the transformers; it is simply in the workspace.

 

 

Did you manage to find a better solution in the end?

 

 

Cheers,

 

Paul

Forum|alt.badge.img

 

Hello piwittle,

 

 

Sorry but I have not found a better solution to the problem ...

 

 

Are you still stuck?

nrich_defra
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 25, 2015
hi I'm getting the same problem.



I cut the root template down to a single line of hard coded json
{'testing' : 'test' }

and I get the error below...




Loaded module 'XMLTemplaterFactory' from file 'D:\FME\plugins/XMLTemplaterFactory.dll'
FME API version of module 'XMLTemplaterFactory' matches current internal version (3.7 20141021)
JSONTemplater(XMLTemplaterFactory): The following error occurred near line 16, column 51 of the query:
JSONTemplater(XMLTemplaterFactory): invalid expression: syntax error, unexpected "{", expecting "external" or ":="



could this be a bug....?  

fme desktop 2015.0 (build 15250)(32-bit)

nrich_defra
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 25, 2015

Just had a really useful chat with Aaron and Xiaomeng via the safe live chat widget - thanks for your support - you were great!

We didn't get to the bottom of it but we got a bit further in the debugging.

I managed to get the JSONTemplater working with on a fresh blank canvas,(proving it's not a bug in the templater per-se) but then when i either copied that transformer onto my existing canvas or copied the transformer/readers/writers to my new blank canvas I got the error i describe above.

i.e. something in my old (fme 2011 based) workbench logic is causing the JSONTemplater to flake out.

Luckily it's quite a simple workbench so i'm going to start from scratch and keep testing the jsontempalter as i build.


nrich_defra
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 25, 2015
nrich wrote:

Just had a really useful chat with Aaron and Xiaomeng via the safe live chat widget - thanks for your support - you were great!

We didn't get to the bottom of it but we got a bit further in the debugging.

I managed to get the JSONTemplater working with on a fresh blank canvas,(proving it's not a bug in the templater per-se) but then when i either copied that transformer onto my existing canvas or copied the transformer/readers/writers to my new blank canvas I got the error i describe above.

i.e. something in my old (fme 2011 based) workbench logic is causing the JSONTemplater to flake out.

Luckily it's quite a simple workbench so i'm going to start from scratch and keep testing the jsontempalter as i build.

So it seems the ESRI 'GEODATABASE_SDE' Reader and Writer cause this issue in my workbench. (the new ones, nothing to do with 2011)

I deleted stuff until it worked - then re added until it stopped working, it was very repeatable.


fmelizard
Safer
Forum|alt.badge.img+19
  • Safer
  • November 25, 2015
nrich wrote:

So it seems the ESRI 'GEODATABASE_SDE' Reader and Writer cause this issue in my workbench. (the new ones, nothing to do with 2011)

I deleted stuff until it worked - then re added until it stopped working, it was very repeatable.

@nrich please do send the workspaces in to support@safe.com so we can dig in. Seems ... inconceivable...


nrich_defra
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 25, 2015

It does seem very odd.

I've stripped the workbench down to the bare bones though and it worked, didn't work, worked, didn't work - you get the picture!

I've sent this test workbench to Xiaomeng via the live chat thingy-ma-bob.

In the mean time I've reverted back to sde30 and the JSONtemplatar works like a charm.


nrich_defra
Contributor
Forum|alt.badge.img+5
  • Contributor
  • November 25, 2015
nrich wrote:

It does seem very odd.

I've stripped the workbench down to the bare bones though and it worked, didn't work, worked, didn't work - you get the picture!

I've sent this test workbench to Xiaomeng via the live chat thingy-ma-bob.

In the mean time I've reverted back to sde30 and the JSONtemplatar works like a charm.

perhaps the geodatabase reader/writer is loading a conflicting xml/json module...


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