Update javascript to use document metadata JSON.