Skip to main content
Archived

Change the behaviour of the fme:get-list-attribute("") function in a JSONTemplat

Related products:Transformers
hvukasinovic
danilo_fme
antoine
arthur_bazin
kalbert
+2
  • hvukasinovic
    hvukasinovic
  • danilo_fme
    danilo_fme
  • antoine
    antoine
  • arthur_bazin
    arthur_bazin
  • kalbert
    kalbert
  • hydrolithe
    hydrolithe
  • josch
    josch

thijsknapen
Contributor

***Note from Migration:***

Original Title was: Change the behaviour of the fme:get-list-attribute("") function in a JSONTemplater, to always return an array (not just when the list contains more than 1 element)


I hope the title is already quite self explanatory.

Let me explain with an example.

Consider the following two lists;

Note that list_1 has a single element, and list_2 has two elements.

When I then use the following text in a JSON templater;

I obtain the following result;

{

    "list_1" : "a",

    "list_2" : [ "b", "c" ]

}

Whereas the following addition of square brackets in the JSONTemplater;

does produce the result I would consider to be the the desirable result from the 'fme_get-list-attribute("")' function.

{

    "list_1" : [ "a" ],

    "list_2" : [ "b", "c" ]

}

undesired_behaviour_getList_function_in_JSONTemplator.fmw

This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

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