XWIKI-9986: The watchlist livetable is empty when the user subscribes to documents containing double quotes
* Build the JSON in memory and then serialize it.

(cherry picked from commit 26d5663b281c55b7a463fe462aa007c4b348210b)