samyyc.dev
LOC::Macau, China

..UTC+8

samyyc.dev

-- BPM

Sat Dec 20 2025

Duper - The Next-Generation JSON-Extended Config File Format

#122

/

samyyc

/

484 words

/

Updated 349 days ago

/

[中文]

Duper is a config file format that's still under active development. The core is written in Rust. It's backward-compatible with JSON, but supports richer syntax and types, and makes input more human-friendly.

Project site: https://duper.dev.br/

Syntax preview

Here's an example Duper config:

Product({
  product_id: Uuid("1dd7b7aa-515e-405f-85a9-8ac812242609"),
  name: "Wireless Bluetooth Headphones",
  brand: "AudioTech",
  price: Decimal("129.99"),
  dimensions: (18.5, 15.2, 7.8),  // In centimeters
  weight: Kilograms(0.285),
  in_stock: true,
  specifications: {
    battery_life: Duration("30h"),
    noise_cancellation: true,
    connectivity: ["Bluetooth 5.0", "3.5mm Jack"],
  },
  image_thumbnail: Png(b64"iVBORw0KGgoAAAANSUhEUgAAAGQ="),
  tags: ["electronics", "audio", "wireless"],
  release_date: PlainDate('2023-11-15'),
  /* Warranty is optional */
  warranty_period: null,
  customer_ratings: {
    latest_review: r#"Absolutely ""astounding""!! 😎"#,
    average: 4.5,
    count: 127,
  },
  created_at: Instant('2023-11-17T21:50:43+00:00'),
})

As you can see, compared to JSON, there are a few differences:

  • Simple keys don't need double quotes
  • Values support type tags
  • More data types and literals (tuples, b64, etc.)

Types

Compared to ordinary config languages, it supports more types. For example, you can declare a bytestring like this:

{
  png_signature: b"\x89PNG\r\n\x1a\n",
  ascii: b"Hello, World!",
  ansi_reset: b"\x1b[0m",
}

It also has time support, with several types for describing absolute times or time differences, based on the RFC 9557 standard.

For example:

{
  // Allowed
  precise_identifier: PlainDateTime('2007-03-31T10:35:10'),
  subset: PlainYearMonth('1994-11-06T19:45:27-03:00'),  // PlainYearMonth is a subset of Instant
}

Duper tuples are like arrays, except the square brackets are replaced with parentheses.

{
  empty_tuple: (),
  another_empty_tuple: (,),
  single_element: (1),
  another_single_element: (1,),
  tuple_of_arrays: ([true, 1.0], ["x", "y", "z"]),
  array_of_tuples: [(1, null), (3, 4.0, 5)],
  nested: (((), ("hi"))),
  multiline_tuple: (
    "Vec",
    "Cow",
    "Arc",
  ),
}

IDE support

There's a Duper - Visual Studio Marketplace VSCode extension you can use to get Duper syntax highlighting in VSCode.

Multi-language support

Rust

Native Rust support, with support for the following crates:

  • serde: integrates the serde library via serde_duper, so you get clean serialization/deserialization, and you can tweak behavior with serde macros (for example, using serde's identifier to serialize a Vec as bytes).
  • tracing: supports tracing via the tracing_duper library, giving you structured output with no pain.
  • axum: via the axum_duper crate, you can use Duper types directly in axum routes.

See: Rust guide | Duper

Python

Get Python support for duper by installing the duper-python package. This package provides serialization/deserialization support like the json package.

Supports Pydantic for typed validation and serialization.

Supports FastAPI, so you can use Duper types directly in route functions.

See: Rust guide | Duper

Javascript

Supports Node.js and Vite, providing functions like stringify for serialization/deserialization.

See: JavaScript guide | Duper

.NET (Alpha)

C# .NET support is still in alpha. See: .NET guide | Duper

Other tools

duperq

duperq is a structured log filter. If you use the duper format for structured log output, you can simply use this CLI tool to filter with variable filter conditions.

See: duperq | Duper

duperfmt

duperfmt is a formatter for duper, built on top of duper-lsp. See: duperfmt | Duper