Skip to main content
Solved

JSON Templater - support for boolean values?

  • July 1, 2019
  • 4 replies
  • 76 views

lazarlubomir
Contributor
Forum|alt.badge.img+10

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"))
}
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

stalknecht
Contributor
Forum|alt.badge.img+21
  • Contributor
  • 305 replies
  • July 2, 2019

Can you share the template you are using?


takashi
Celebrity
  • 7843 replies
  • 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+10
  • Author
  • Contributor
  • 165 replies
  • 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"))
}

@takashi Thank You so much!


jpvo
Contributor
Forum|alt.badge.img+1
  • Contributor
  • 58 replies
  • June 8, 2021

Thank you takashi!