Skip to main content
Solved

JSON Templater - support for boolean values?


lazarlubomir
Contributor
Forum|alt.badge.img+7

Hello everybody,

because of specific demand I have to use JSON templater -> TXT writer workflow. But, when I need to export values true/false as boolean data type, JSON templater still put me there quotation marks for values true/false - so result is "True" or "False".

Please, has anybody idea, how to figure it out to write bool values without quotation marks?

Thank You so much!

Lubo

Best answer by takashi

If a feature attribute (e.g. called "attr") stores 1, 0, "true" or "false", this template expression converts the value to a boolean value - true or false without quotations.

{
    "attr" : xs:boolean(fme:get-attribute("attr"))
}
View original
Did this help you find an answer to your question?

4 replies

stalknecht
Contributor
Forum|alt.badge.img+19
  • Contributor
  • July 2, 2019

Can you share the template you are using?


takashi
Influencer
  • Best Answer
  • July 2, 2019

If a feature attribute (e.g. called "attr") stores 1, 0, "true" or "false", this template expression converts the value to a boolean value - true or false without quotations.

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

lazarlubomir
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • July 2, 2019
takashi wrote:

If a feature attribute (e.g. called "attr") stores 1, 0, "true" or "false", this template expression converts the value to a boolean value - true or false without quotations.

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

@takashi Thank You so much!


jpvo
Participant
Forum|alt.badge.img+1
  • Participant
  • June 8, 2021

Thank you takashi!


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