Serialises an arbitrary object as JSON, handling primitive types as well as Collections, Maps, and arrays.
Writes a File (its content) into the stream