This commit implements a method for exporting the state of a flow into a
JSON-serializable dictionary.
The idea is producing a human-readable version of state that can be
inspected or consumed by other systems, hence JSON and not pickling or
marshalling.
I consider it an export because it's a one-way process, meaning it
cannot be loaded back into Python because of complex types.