MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / safeJsonParse

Function safeJsonParse

apps/webapp/app/utils/json.ts:3–13  ·  view source on GitHub ↗
(json?: string)

Source from the content-addressed store, hash-verified

1import { z } from "zod";
2
3export function safeJsonParse(json?: string): unknown {
4 if (!json) {
5 return;
6 }
7
8 try {
9 return JSON.parse(json);
10 } catch (e) {
11 return null;
12 }
13}
14
15export function safeJsonZodParse<T>(
16 schema: z.Schema<T>,

Callers 11

actionFunction · 0.90
getSecretMethod · 0.90
getSecretsMethod · 0.90
onMethod · 0.90
humanToCronFunction · 0.90
#onMessageMethod · 0.90
prepareErrorDataMethod · 0.90
safeJsonZodParseFunction · 0.70
safeJsonFromResponseFunction · 0.70
safeBodyFromResponseFunction · 0.70

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…