atproto utils for zig zat.dev

json.extractAt should report which field failed and why #1

Closed zat.dev
Closed opened by zat.dev

When using extractAt to parse a struct from JSON, if a field can't be parsed (e.g., type mismatch), the function returns null with no indication of what went wrong.

Reproduction: Try parsing a JSON object with "action": "create" into a struct with action: SomeEnum. The extraction silently fails.

Suggested improvement: Return or log diagnostic info like:

extractAt failed: field 'action' - expected enum SomeEnum, got string "create"

This would save significant debugging time when working with external JSON APIs (like TAP) where the exact field types aren't always documented.

Sign up or Sign in to add to the discussion.