Skip to main content

Hi,

I have a workspace the reads json files:

 

I need to publish this to Flow, and configure parameters to enable the user in Flow to read files from a certain folder. This will change several times, and I do not mind this part being a manual process.

I am unsure of exactly how to configure this.

I have set up a Folder and Pathnames user parameter:

I have configured it to select Folders, and called this “SourceDataset_PATH”.

 

I have then configured the parameter for the json reader to point at the SourceDataset_PATH parameter.

 

I publish to FME Server, run the workspace:

 

I have used “Browse Resources” to find a folder “Test 1 file” and hit Run.

If fails after a few seconds:

54

2024-11-13 17:17:27 | The file 'C:\ProgramData\Safe Software\FME Server\resources\data\WACSTEST_1_to_5\Test 1 file' could not be opened

53

2024-11-13 17:17:27 | Opening the JSON reader with source dataset 'C:\ProgramData\Safe Software\FME Server\resources\data\WACSTEST_1_to_5\Test 1 file'

52

2024-11-13 17:17:27 | FME API version of module 'JSON' matches current internal version (4.0 20220615)

 

What am I doing wrong? Do I need the Folder and Pathnames user parameter? Do I set the JSON Reader to look for files or folders?

I’ve tried several different methods of configuring the workbench and readers with no luck.

Please help! :-)

Regards

Stu

 

It sounds like you may be looking for the Directory and File Pathnames reader. You could use a Directory and File Pathnames reader to read in folder of an input path, it would identify all of the files inside of that folder. You can apply any filtering if needed and then could use a FeatureReader to do the JSON file reading.


You want to set up the reader in the workspace something like this, if you want the reader to read all json files in a particular folder specified by your parameter

 

 


Thank you for your prompt response, Liamfez.
I had a little dabble with your suggested solution. However, before I had got it sorted I simply used this method for reading all of the files in a folder…
 


What had tripped me up is that if there is only one file in that folder then it doesn’t work! (FME Server 2022.2.1)

As soon as I added a second file into the folder (“Test 1 file”… but now it had 2 files! 🤣) then it worked immediately.

I am off for a lie down in a dark room. 
 

Stu


Thank you ​@ebygomm that is exactly what I was looking for. It was just adding the “\*.json” to the end that I was missing. Although in my case as these are zipped up I added “\*.gz” and that did the trick.

Many thanks.


Reply