3 ms·
const Json = union(enum) { null, number: f64, bool: bool, string: []const u8, array: []const Json, object: HashMap([]const u
by nyberg 5y ago
const Json = union(enum) {
null,
number: f64,
bool: bool,
string: []const u8,
array: []const Json,
object: HashMap([]const u8, Json),
};
Usually it's a tagged union of the base JSON types which can easily be consumed by most statically typed languages or a variant of it.
EDIT: added "tagged"