Skip to content
Discussion options

You must be logged in to vote

You can read from a file and json parse it like so

const abi = @import("zabi-abi"); // or const abi = @import("zabi").abi;

const file = try std.fs.cwd().openFile("abi.json", .{});
defer file.close();

const content = try file.readToEndAlloc(std.heap.page_allocator, std.math.maxInt(u32));
defer std.heap.page_allocator.free(content);

const parsed = try std.json.parseFromSlice(abi.Abi, std.heap.page_allocator, content, .{});
defer parsed.deinit();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eniolasonowo
Comment options

Answer selected by eniolasonowo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants