Skip to main content

I am having trouble understanding the documentation for the JSONUpdater tool. I've put together a simple workspace (attached) that demonstrates my partial success. I want to create a GeoJSON file from a shapefile. I can successfully do this with FeatureWriter. So far so good. See screenshots 1. and 2. below.

 

Now I want to add a key-value pair to the root of the JSON object that would identify the edition of the collection -- as shown in screenshot 3. So I include the JSONUpdater transformer. as pictured in Screenshot 4. below. I've tried a lot of options in this transformer but nothing I do has any effect on the json file.

 

Can someone give me a hint?

 

Screenshot 1: Workbench diagram

workbench_diagramScreenshot 2: FeatureWriter Parameters

Screenshot 1: Featurewriter parametersScreenshot 3: Geojson I get.

Scereenshot 2: GeoJSON I have. Screenshot 4: GeoJSON I want.Screenshpot 3: geojson_I_wantScreenshot 5: JSON Updater Parameters.

Screenshot 4. JSON Updater parameters

Hi @paulbcote​ 

The setup of the JSONUpdater is mostly correct if JSON Path is json. I think the issue is with the path of the JSON file (eg. .\\output.json). Try exposing the dataset parameter in the FeatureWriter's summary port and using that to specify the path to the JSON file within the JSONUpdater.

Note that your inserted object will appear at the end of the JSON.


Reply