+11
-2
README.md
+11
-2
README.md
···
79
79
navigate nested json without verbose if-chains:
80
80
81
81
```zig
82
-
// instead of 6 nested if-checks:
82
+
// runtime paths for one-offs:
83
83
const uri = zat.json.getString(value, "embed.external.uri");
84
-
const items = zat.json.getArray(value, "posts");
85
84
const count = zat.json.getInt(value, "meta.count");
85
+
86
+
// comptime extraction for complex structures:
87
+
const FeedPost = struct {
88
+
uri: []const u8,
89
+
cid: []const u8,
90
+
record: struct {
91
+
text: []const u8 = "",
92
+
},
93
+
};
94
+
const post = try zat.json.extractAt(FeedPost, allocator, value, .{"post"});
86
95
```
87
96
88
97
## specs