Upon close look I realised that there was a lot of allocations there. It turned
out to be because it's allocating for the whole size of the value for every item.
This way we just do it for the value of the element.
It also includes a unit test that showed this escaping code never actually worked
because the parser was choking on it.