Question

Error in JSONTemplater


Userlevel 4
Badge +30

Hello all,

I tried to use the transformer JSONTemplater but my log file shows a error:

WARN  |JSONTemplater_2(XMLTemplaterFactory): The following error occurred near line 1, column 14 of the query:

2016-06-27 11:03:12|   1.4|  0.0|WARN  |JSONTemplater_2(XMLTemplaterFactory): invalid expression: syntax error, unexpected ExprSingle (missing comma "," between expressions?)

 

My configuration:

atendimentos:[{
                                  "status":fme:get-attribute("Status"),
                                  "regiao":fme:get-attribute("regiao"), 
                                  "numserv":fme:get-attribute("numserv"),
                                  "label_veiculo":fme:get-attribute("label_veiculo"),
                                  "placa":fme:get-attribute("placa"),
                                  "dh_aciona":fme:get-attribute("dh_aciona"),
                                  "tipo_serv ":fme:get-attribute("tipo_serv"),
                                  "ident_turma":fme:get-attribute("ident_turma"),
                                  "dh_designa":fme:get-attribute("dh_designa"),
                                  "latitude":fme:get-attribute("latitude"),
                                  "longitude":fme:get-attribute("longitude"),
                                  "id_abrangencia":fme:get-attribute("id_abrangencia"),
                                  "precisao_calculada":fme:get-attribute("previsao_calculada")
                 }]

Thanks in Advance,


2 replies

Userlevel 2
Badge +17

Hi @danilo_inovacao, I found two issues in your expression.

  • The entire JSON object should be surrounded by curly brackets {}.
  • Name of a JSON object/array should be surrounded by double quotations.

Try modifying the expression, like this.

{
    "atendimentos":[{
        ...
    }]
}
Userlevel 4
Badge +30

Hi @danilo_inovacao, I found two issues in your expression.

  • The entire JSON object should be surrounded by curly brackets {}.
  • Name of a JSON object/array should be surrounded by double quotations.

Try modifying the expression, like this.

{
    "atendimentos":[{
        ...
    }]
}

thanks a lot @takashi :)

Its works!

Reply