Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zon-ts

A small TypeScript parser and serializer for Zig Object Notation (ZON). It runs on Deno and is packaged for Node with dnt.

import { parse, stringify } from "@jassielof/zon";

const manifest = parse<{ minimum_zig_version?: string }>(
  await Deno.readTextFile("build.zig.zon"),
);

const text = stringify({
  name: "example",
  paths: ["src", "build.zig"],
}, { space: 4 });

parse supports ZON structs, arrays, strings (including multiline strings), character and enum literals, integers, floats, booleans, null, nan, and infinities. Large integers return bigint by default. Enum and character literals use EnumLiteral and CharLiteral wrapper classes unless an alternate representation is selected through ParseOptions.

deno task test
deno task check
deno task pack

See Zig's std.zon documentation for the format itself.

About

A TypeScript library for the Zig Object Notation (ZON).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages