Skip to main content

When using the JSONTemplater I want to be able to add a real boolean to the template and not get a string.

string_booleanI made a work around by replacing the text boolean by a real boolean:

 real_booleanHas anyone figured out how to handle a boolean without the need of replacing?

Try casting to a boolean datatype in the JSONTemplater:

{
  "istrue": xs:boolean(fme:get-attribute("istrue"))
}

The attribute should either contain an integer (0 or 1) or the string "true" / "false".


Thanks @david_r​. Works like a charm.

solution_booleanDo you have link to the documentation where this wisdom is documented?


Thanks @david_r​. Works like a charm.

solution_booleanDo you have link to the documentation where this wisdom is documented?

I don't think it's documented in FME, you'll have to look it up in one of the many XQuery documentations online, e.g. https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqtypecon.html#wp1118764


Reply