Hi folks,
I got an answer to this directly from the developer.
Hope it's useful
Mark
---------------------------------------------
The short answer is: use an XQuery type cast, in this case xs:int, like so:
{
"status" : xs:int( fme:get-attribute("int_attr") )
}
The longer answer is this:
The fme:get-attribute function will return a value whose type corresponds to the underlying type of the FME attribute. In this case, the attribute is likely a string attribute. This can be checked by using a Logger transformer.
A 'cast' can be used to convert a string value to an integer. The syntax is quite simple, xs:int( "132" ). Strings can be converted to quite a few numeric types, but for JSON, the most useful casts will be:
Using something like @int will probably not work, as the TCL is executed before the XQuery. In addition, the use of Tcl or FME functions within a JSON/XML template will have a severe negative effect on the performance of the transformer.