Created a json writer

Also added test ensuring that the json writer behaves correctly