Escape apostrophes when encoding json into an element