Fixed a bug in YamlOutput that will produce invalid json files, add python test to test validness of generated json files

YamlOutput produced invalid jsons files in the case when unescaped strings were stored.