Skip to content

gadgetSuccess

gadgetSuccess(data): string

Defined in: gadgets/helpers.ts:70

Create a success response as JSON string.

This is a convenience helper for gadgets that return JSON-formatted responses. It automatically adds success: true and stringifies the result.

Record<string, unknown> = {}

Additional data to include in the response

string

JSON string with success: true and provided data

return gadgetSuccess({ url: page.url(), title: await page.title() });
// Returns: '{"success":true,"url":"...","title":"..."}'