Sample code for 30+ languages & platforms
Zig

Decode HTML Entity Encoded JSON

See more JSON Examples

Decodes an HTML entity encoded string to JSON.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const sb = try chilkat.StringBuilder.init();
    defer sb.deinit();

    try sb.append("{"xyz": "abc"}");

    sb.entityDecode() catch {};

    // This is a test comment;
    std.debug.print("{s}\n", .{try sb.getAsString(alloc)});

    // Output is:

    // {"xyz": "abc"}
}