CToon.jl
Julia binding for ctoon, via direct ccall into the C core — the same approach the Rust and Zig bindings take.
Installation
CToon.jl lives inside the main ctoon monorepo, under src/bindings/julia/, alongside every other language's binding. It isn't registered in Julia's General registry yet, so install it straight from GitHub with subdir — the standard Pkg mechanism for installing one package out of several that live in one git repo:
import Pkg
Pkg.add(url="https://github.com/mohammadraziei/ctoon.git", subdir="src/bindings/julia")That's it — Pkg.add runs deps/build.jl for you automatically as part of the install (it compiles ctoon.c plus a small C shim into a shared library; no separate C library install, no BinaryBuilder/JLL step, just a C compiler on the build host).
using CToon
CToon.parse("{\"a\": [1, 2, true]}")
# OrderedDict{String, Any}("a" => Any[1, 2, true])
CToon.dumps(Dict("a" => 1, "b" => [1, 2, 3]))
# "a: 1\nb[3]: 1,2,3"Developing against a local checkout
Working on the binding itself, from inside a clone of the ctoon repo:
cd src/bindings/julia
julia deps/build.jl
julia --project=. -e 'using Pkg; Pkg.instantiate(); include("test/runtests.jl")'Pkg.develop(path="src/bindings/julia") also works from any other project's environment, if you want to iterate on the binding while using it from elsewhere.
Scope
parse/parse_toon— JSON and TOON reading respectively, into nativeOrderedDict{String,Any}/Vector{Any}/String/Int64/UInt64/Float64/Bool/nothing.OrderedDictspecifically (notBase.Dict) so that aparse→dumps/to_jsonround trip preserves key order.dumps/to_json— the reverse: any of those same native shapes, encoded as TOON or JSON text.
API Reference
CToon.dumps — Method
CToon.dumps(value) -> StringEncode a native Julia value (as CToon.parse would produce: AbstractDict, Vector, AbstractString, Bool, Integer, AbstractFloat, or nothing) as TOON text.
CToon.parse — Method
CToon.parse(str::AbstractString) -> AnyParse str (TOON/JSON per ctoon's reader) and return it as native Julia data: OrderedDict{String,Any} for objects (order-preserving — see _to_julia's own comment), Vector{Any} for arrays, String, Int64/Float64, Bool, or nothing.
CToon.parse_toon — Method
CToon.parse_toon(str::AbstractString) -> AnyParse str as TOON (not JSON – see CToon.parse for that) and return it as native Julia data, same value shapes as CToon.parse.
CToon.spec_date — Method
CToon.spec_date() -> StringThe release date of the targeted spec, e.g. "2026-07-26".
CToon.spec_tag — Method
CToon.spec_tag() -> StringThe toon-format/spec git tag this build targets, e.g. "v4.1.2".
CToon.spec_version — Method
CToon.spec_version() -> StringThe TOON spec version this build targets, e.g. "4.1" (spec §13), from the C core.
CToon.to_json — Method
CToon.to_json(value) -> StringEncode a native Julia value the same way CToon.dumps does, but as JSON text instead of TOON.