{{ indent }}const {{ name }}_z: ?[:0]u8 = if ({{ name }}) |v| try std.heap.c_allocator.dupeZ(u8, v) else null;
{{ indent }}defer if ({{ name }}_z) |z| std.heap.c_allocator.free(z);
{{ indent }}const {{ name }}_handle = if ({{ name }}_z) |z| c.{{ prefix }}_{{ snake }}_from_json(z.ptr) else null;
{{ indent }}if ({{ name }}_z != null and {{ name }}_handle == null) {{ json_error_return }}
{{ indent }}defer if ({{ name }}_handle) |h| c.{{ prefix }}_{{ snake }}_free(h);
