Escaping quotes in json files

and added micro optimization in for loop