made it output in json, there is a problem in that it adds an unnecessary \ to escape character