MCPcopy Create free account
hub / github.com/github/gh-aw / parseJSONPayload

Function parseJSONPayload

actions/setup/js/invocation_context_helpers.cjs:93–108  ·  view source on GitHub ↗

* Parse a JSON input string into object payload. * @param {unknown} value * @returns {Record |null}

(value)

Source from the content-addressed store, hash-verified

91 * @returns {Record<string, any>|null}
92 */
93function parseJSONPayload(value) {
94 if (typeof value !== "string" || value.trim() === "") {
95 return null;
96 }
97
98 try {
99 const parsed = JSON.parse(value);
100 if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
101 return /** @type {Record<string, any>} */ parsed;
102 }
103 } catch (_error) {
104 // Best-effort parsing only.
105 }
106
107 return null;
108}
109
110/**
111 * Build a minimal event payload from aw_context metadata for centralized slash-command dispatches.

Callers 1

resolveInvocationContextFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected