Zig
Zig
AppendArrayItems Example
Demonstrates the AppendArrayItems function.Note: This example requires Chilkat v9.5.0.82 or above.
Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const jarr1 = try chilkat.JsonArray.init();
defer jarr1.deinit();
jarr1.load("[ 1, 2, 3, 4]") catch {};
const jarr2 = try chilkat.JsonArray.init();
defer jarr2.deinit();
jarr2.load("[ 5, 6, 7, 8]") catch {};
jarr1.appendArrayItems(jarr2) catch {};
std.debug.print("{s}\n", .{try jarr1.emit(alloc)});
// Expected output: [1,2,3,4,5,6,7,8]
std.debug.print("{s}\n", .{try jarr2.emit(alloc)});
// Expected output: [5,6,7,8]
}