I also have am FME script that subscribes to the topic and takes action when the topic receives the JSON above. However, I only want the script to take action if the directory change is a "modify" to a certain file (in this case, "New Text
Document.txt"). There are other files in this directory and I don't want the script to take action when any of them change.

Is it possible for my FME script to get access to this JSON? Then I can break it down and determine which directory change occurred.

Then when you publish the workspace, click the notification
properties button and select the Textfile Reader as the Notification
Data Reader.

Now when you workspace is triggered by the notification, the JSON message will be passed into the workspace through this Reader. You can then process it using JSONFlattener transformers, or similar, to find out details of the notification.

This works fine up until the jsonflattener. Then I get errors in my log file like:

JSONFlattener(JSONQueryFactory): A JSON syntax error was found at line 1, column 1

...and

JSONFlattener(JSONQueryFactory): The JSON data is incomplete: Unexpectedly encountered the end of JSON data

I have also tried parsing the text_line_data in a PythonCaller using the built-in json module with the same result. I think the problem is that the jsonflattener and the Python module don't understand the newlines in the notification output. Has anyone at Safe actually got this to work?

Some quick thoughts. Maybe set the TextFile Reader to "read whole file at once". It might be reading it as a multi-line dataset, and trying to parse a line at a time (how many features does it read?) - also perhaps set a Character Encoding for the Reader? Finally, can you put a Logger transformer in before the JSONFlattener to get a better idea of what is being returned? I suspect the problem is somehow in how the TextFile reader is reading the data.