> Development branch documentation · commit 327c05c78d2f528e4f4a679fcc7a77d9aa161f48
> Package versions: @zenfg/webgpu 0.1.0, @zenfg/snapshot 0.1.0, @zenfg/inspector 0.1.0, zenfg 0.1.0, zenfg-snapshot 0.1.0
> Source: https://github.com/uinosoft/zenfg/blob/327c05c78d2f528e4f4a679fcc7a77d9aa161f48/packages/snapshot/src/codec.ts#L95

[ZenFG TypeScript API](/zenfg/docs/api/index.md) / [snapshot](/zenfg/docs/api/snapshot/index.md) / [root](/zenfg/docs/api/snapshot/root/index.md) / decodeFrameGraphSnapshot

# Function: decodeFrameGraphSnapshot()

> **decodeFrameGraphSnapshot**(`value`): [`FrameGraphSnapshotDecodeResult`](/zenfg/docs/api/snapshot/root/type-aliases/FrameGraphSnapshotDecodeResult.md)

Defined in: [packages/snapshot/src/codec.ts:95](https://github.com/uinosoft/zenfg/blob/327c05c78d2f528e4f4a679fcc7a77d9aa161f48/packages/snapshot/src/codec.ts#L95)

Decodes an already-parsed value into a canonical Snapshot 1.2 document.

## Parameters

### value

`unknown`

## Returns

[`FrameGraphSnapshotDecodeResult`](/zenfg/docs/api/snapshot/root/type-aliases/FrameGraphSnapshotDecodeResult.md)

## Remarks

Snapshot 1.1 is strictly validated before upgrading. Supported
Legacy V0 and Legacy Candidate V1 captures are migrated
before validation. Successful results identify the source format and carry
migration warnings; unsupported, malformed, or semantically invalid values
return `{ ok: false, issues }` and do not throw. Decoding and migration do
not mutate the input value. Returned JSON objects (including extensions)
have null prototypes; arrays use the current realm's Array prototype. Use
`Object.hasOwn(object, key)` instead of inherited object methods.
Input properties are inspected through data
descriptors, so getters and `toJSON` hooks are never invoked. Extension
object/array nesting is limited by
[FRAME\_GRAPH\_SNAPSHOT\_MAX\_EXTENSION\_DEPTH](/zenfg/docs/api/snapshot/format/variables/FRAME_GRAPH_SNAPSHOT_MAX_EXTENSION_DEPTH.md).

## Example

```ts
const result = decodeFrameGraphSnapshot(untrustedValue);
if (result.ok) console.log(result.snapshot.graph.nodes.length);
else console.error(result.issues);
```
