bug 875349: Build JSON metadata for Documents at rendering time