Skip to main content
Solved

Paste aggregator result into JSON attributes

  • February 7, 2019
  • 2 replies
  • 7 views

Hello,

I'm new to FME and I'm looking to get a JSON file formatted like this :

{
    "depart": {
        "INCENDIE" : 533,
        "AUTRES" : 30,
        "RISQUES TECHNOLOGIQUES" : 71,
        "OPERATIONS DIVERSES" : 320,
        "ACCIDENT" : 411,
        "SECOURS A PERSONNE" : 3813
    }
}

The data comes from the following treatment : 

0684Q00000ArCqvQAF.png

And the inspector give me that informations :

0684Q00000ArCpTQAV.png

 

I've try to use the following treatment :

0684Q00000ArCYRQA3.png

 

With that configuration : 

0684Q00000ArCUPQA3.png

 

0684Q00000ArCsZQAV.png

 

0684Q00000ArCmaQAF.png

 

0684Q00000ArCseQAF.png

 

0684Q00000ArCsjQAF.png

 

But I can not get the desired result as above.

If anyone could help me ...? 

 

Best regards.

Best answer by takashi

This workflow might help you.

Root Template:

{
    "depart" : {|
        fme:process-features("SUB")
    |}
}

SUB Template:

{fme:get-attribute("MOTIF_DEPART") : fme:get-attribute("VAL")}

0684Q00000ArLMYQA3.png

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.

2 replies

takashi
Celebrity
  • 7843 replies
  • Best Answer
  • February 7, 2019

This workflow might help you.

Root Template:

{
    "depart" : {|
        fme:process-features("SUB")
    |}
}

SUB Template:

{fme:get-attribute("MOTIF_DEPART") : fme:get-attribute("VAL")}

0684Q00000ArLMYQA3.png


  • Author
  • 1 reply
  • February 8, 2019

Thanks a lot, i get the expected result now.

 

Best regards !