Refactor JSON output to prevent concurrency bugs
Created by: femtobit
The JSON output bug fixed by #64 was caused because converting an ObsManager
to JSON performs an MPI reduction and thus has to be called from all processes, while in the first version of my code it was only called by rank 0.
This PR adds a few changes to the output code to make errors like this less likely.