5 Persisting Dictionaries In JSON Files - essenius/FitNesseFitSharpSupportFunctions GitHub Wiki
An alternative to persisting dictionaries to a FitNesse page is simply storing them in a file. The JSON format was chosen as that’s a very common text based format, and very well suited to persist dictionaries. The API is simple: there is a Save File, a Load File, a Delete File and a Wait For File function. All of them can have a file name as a parameter; if omitted the last set filename will be used (default is DictionaryStore.json). You can also explicitly set or get the filename via the File Name property. If the file name is a relative path, it will start from the work folder of the FitNesse process, which is the Fixtures folder if you used the convention of this book. Here is an example:
!define FileName {myfile.json}
|script |dictionary library|!{name:bob, address:here}|
|check |count |2 |
|check |get |address |here |
|Add |phone |value |12345 |
|set |employed |to |true |
|save file|${FileName} |
|check |file name |${FileName} |
Create a new dictionary (different instance),
and load the file we just saved. Delete it
then, so we don't leave a mess. Then check
if the data loaded correctly
!|script |dictionary library|
|check |count|0 |
|load file|${FileName} |
|delete file |
|check |count|4 |
|check |get |name|=~/b.b/|
|ensure |get |employed |

The Wait For File function is useful when another process is expected to create a file that the test uses. For example, if you are using a REST call to another FitNesse page, that runs in another thread. The function first waits for the file to get created, and then for the lock to be released.