Skip to main content
Solved

JSON Templator for Parameters


deanhowell
Influencer
Forum|alt.badge.img+23

I am reading in a very poorly formatted JSON file which has hundreds of lines but I just want to extract some key attributes that will then be used to create a JSON file that can be passed to FME Flow to start a work bench using the extracted attributes.

 I am reading the JSON file in and running it through an attribute manager to get the attributes I need. If I then run through JSON writer I just get a list like this

[
    {
        "json_featuretype" : "JSONFeature",
        "Catalogue Key" : "Data Catalogue",
        "Layer Name" : "Testville Roads",
        "Data From" : "Import type from CSV file",
        "Data Access" : "Restricted",
        "Update User" : "Alex",
        "Description" : "Roads data for Testville COuncil",
        "Dataset Dimension" : "3D",
        "Data Update Frequency" : "As needed",
        "Geometry Type" : "Points",
        "Spatial Presentation Type" : "Vector",
        "Data Currency" : "2025-11-09",
        "Initial Publication Date" : "2025-04-15",
        "Contact" : "Fred Flintstone",
        "Data Classification" : "Business Impact Levels (BIL)",
        "Dataset Aggregator" : "Spatial Test",
        "Organisation" : "Spatial Test",
        "Data Distributor" : "Spatial Test",
        "Data Transfer Medium" : "File Upload",
        "Creation Request Key" : "DNSS-60064"
    }
]

 

But what I want is to end up with a file like the following:

 

{

  "publishedParameters": [

    {

      "name": "Layer Name",

      "value": "Testville Roads"

    },

    {

      "name": "Data Access",

      "value": "Restricted"

    }

  ]

}

 

What is the best approach to pass these parameters to FME Flow so they can be used to populate the parameter files in the Flow workbench?

Best answer by j.botterill

rather than the writer you have, replace it with an “Automations writer”. In the attributeManager remove all the attributes you don’t need. Keep layer name attribute but rename it to ‘value’. Create a new attribute called ‘name’ and set the fixed value of “Layer Name”. Pass only these two into the writer.

Then you needs to setup an automation in Flow and follow https://docs.safe.com/fme/html/FME-Flow/WebUI/Automations-Actions/Run-Workspace-Routing-Data.htm

View original
Did this help you find an answer to your question?

2 replies

j.botterill
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • May 4, 2025

rather than the writer you have, replace it with an “Automations writer”. In the attributeManager remove all the attributes you don’t need. Keep layer name attribute but rename it to ‘value’. Create a new attribute called ‘name’ and set the fixed value of “Layer Name”. Pass only these two into the writer.

Then you needs to setup an automation in Flow and follow https://docs.safe.com/fme/html/FME-Flow/WebUI/Automations-Actions/Run-Workspace-Routing-Data.htm


deanhowell
Influencer
Forum|alt.badge.img+23
  • Author
  • Influencer
  • May 5, 2025

Thanks ​@j.botterill that solves lots of issues.


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