Properly escape " marks when writing index/type/id