Skip to main content
Solved

JSONTemplater does not set double quotes for number values

  • October 31, 2023
  • 3 replies
  • 49 views

tschoppenhof
Contributor
Forum|alt.badge.img+7

My configuration in the JSONTemplater looks like this:

 

{

  "type": "Feature",

  "geometry": {

    "type": "Point",

    "coordinates": [

      fme:get-attribute("X"),

      fme:get-attribute("Y")

    ]

  },

  "properties": {

  "33064" : fme:get-attribute("33064"),

  "33085" : fme:get-attribute("33085"),

  "33103" : fme:get-attribute("33103")

  }

}

 

As result I get:

 

{ "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ 7.61438690276304, 47.5603635244644 ] }, "properties" : { "33064" : "", "33085" : 94328460, "33103" : "2. von B Spezmast Nr.55" } }

 

The number is not set in double quotes which results in error when I use the json string. Any ideas what could be the reason.

Best answer by takashi

Hi @tschoppenhof​ ,

You can cast a numeric value to a string value with the "xs:string" function.

Try this.

"33085" : xs:string(fme:get-attribute("33085")),

 

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.

3 replies

takashi
Celebrity
  • Best Answer
  • October 31, 2023

Hi @tschoppenhof​ ,

You can cast a numeric value to a string value with the "xs:string" function.

Try this.

"33085" : xs:string(fme:get-attribute("33085")),

 


tschoppenhof
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • October 31, 2023

Thanks takahshi, this works fine.


  • November 21, 2023

Hi @tschoppenhof​ ,

You can cast a numeric value to a string value with the "xs:string" function.

Try this.

"33085" : xs:string(fme:get-attribute("33085")),

 

This was helpful to guide me to all different XQuery functions, needed the xs:double.

For several other functions look at the w3 documentation

XPath and XQuery Functions and Operators 3.0 (w3.org)