by hgs3 on 3/31/25, 12:34 PM with 61 comments
In my opinion, JSON works well for data interchange, but it's overused for configuration, it's not localization-friendly, and it's too syntactically noisy. INI is simple but lacks hierarchical structures and doesn't have a formal specification. Confetti is intended to bridge the gap.
I aim to keep Confetti simple and minimalistic, while encouraging others to extend it. Think of it like Markdown for configuration files: there's a core specification, but your welcome to create your own variations that suit your needs.
by IshKebab on 4/2/25, 9:33 AM
It clearly competes with JSON.
I think I would still much rather use JSON5 over this. It's quite similar in terms of structure and terseness, but I don't have to learn anything.
// This is a comment.
{
probe_device: ["eth0", "eth1"],
users: [
{
user: "*",
login: "anonymous",
password: "${ENV:ANONPASS}",
machine: "167.89.14.1",
proxy: {
try_ports: [582, 583, 584],
},
},
{
user: "Joe Williams",
login: "joe",
machine "167.89.14.1",
},
],
}
Still, it seems fairly well designed and elegant. Way better than YAML or TOML for example. Typeless seems like a bad decision in some ways but I can see the advantages.Top marks on the name!
by unwind on 4/2/25, 9:24 AM
The first paragraph says:
[...] It is minimalistic, untyped, and opinionated. [...]
but then under "Notable features" it begins with a big bold *Unopinionated*, so that was very confusing.
by h1fra on 4/2/25, 10:01 AM
by Myrmornis on 4/2/25, 9:05 AM
by alpaca128 on 4/2/25, 8:51 AM
Good to see a push towards less syntactic overhead, which is still considerable in JSON.
by chrismorgan on 4/2/25, 11:24 AM
> Confetti source text consists of zero or more Unicode scalar values. For compatibility with source code editing tools that add end-of-file markers, if the last character of the source text is a Control-Z character (U+001A), implementations may delete this character.
I’ve heard of this once, when researching ASCII control codes and related ancient history, but never once seen it in real life. If you’re insisting on valid Unicode, it sounds to me like you’re several decades past that happening.
And then given that you forbid control characters in the next section… make up your mind. You’re saying both that implementations MAY delete this character, and that source MUST NOT use it. This needs clarification. In the interests of robustness, you need to specify what parsers MUST/SHOULD/MAY do in case of content MUST violations, whether it be reject the entire document, ignore the line, replace with U+FFFD, &c. (I would also recommend recapitalising the RFC 2119 terms. Decapitalising them doesn’t help readability because they’re often slightly awkward linguistically without the reminder of the specific technical meaning; rather it reduces their meaning and impact.)
> For compatibility with Windows operating systems, implementations may treat the sequence Carriage Return (U+000D) followed by Line Feed (U+000A) as a single, indivisible new line character sequence.
This is inviting unnecessary incompatibility. I recommend that you either mandate CRLF merging, or mandate CR stripping, or disallow special CRLF handling. Otherwise you can cause different implementations to parse differently, which has a long history of causing security problems, things like HTTP request smuggling.
I acknowledge this is intended as the base for a family of formats, rather than a strict single spec, but I still think allowing such variation for no good reason is a bad idea. (I’m not all that eager about the annexes, either.)
by mncharity on 4/2/25, 12:09 PM
[1] https://en.wikipedia.org/wiki/Comparison_of_data-serializati... [2] https://rigaux.org/language-study/syntax-across-languages.ht...
by bobuk on 4/11/25, 2:01 PM
I spent a couple hours writing a fully complaint parser in pure Python. It passes all tests, and among other things has a separate "mapper" mode for more pythonic usage.
by buzzm on 4/6/25, 10:16 PM
by EdgeExplorer on 4/2/25, 3:10 PM
Most existing formats are really bad for at least one of these. Tables in JSON have tons of repetition. XML doesn't have a clear and obvious way to do maps. Almost anything other than XML is awkward at best for node trees.
Confetti seems to cover maps, trees, and non-nested lists really well, which isn't a combination any other format I'm aware of covers as well.
Nested lists and tables seem like they would be more awkward, though from what I can tell "-" is a legal argument, so you could do:
nestedlist {
- { - 1 ; - 2 }
- {
- { - a ; - b }
- { - c ; - d }
}
}
To get something like [[1, 2], [[a, b], [c, d]]]. Of course you could also name the items (item { item 1 ; item 2 }), but either way this is certainly more awkward than a nested list in JSON or YAML.I think a table could be done like JSON/HTML with repeated keys, but maybe also like:
table name age favorite-color {
row Bob 87 red
row "Someone else" 106 "bright neon green"
}
This is actually pretty nice.In any event, I love seeing more exploration of configuration languages, so thanks for sharing this!
My number 1 request is a parser on the documentation page that shows parse tree and converts to JSON or other formats so you can play with it.
by crabbone on 4/2/25, 12:19 PM
I'd take Prolog without I/O and (some? all?) extra-logical predicates as configuration language. Maybe if there's a way to require recursion to terminate, that'd be great, but not essential.
by Aachen on 4/2/25, 1:09 PM
One thing I didn't understand is this example on the homepage:
> password "${ENV:ANONPASS}"
The spec doesn't seem to mention any ${}. Is this for the program to manage rather than the parser of the config going out to fetch an env var? If so, I find this a bit out of scope to show; at least, it confused me about whether that's built-in/supported syntax or if it's just a literal with syntax intended for a different program
Depending on how set in stone this is, another complaint I might have is that you still have the trailing comma issue from JSON, except it's not a comma but a backslash (reverse solidus, as the spec calls it—my mobile keyboard didn't even know that word). Maybe starting a list of arguments with [ could allow one to use any number of lines for the values, until a ] is encountered?
by nalakawula on 4/2/25, 10:16 AM
example.com {
root \* /var/www/wordpress
encode
php_fastcgi unix//run/php/php-version-fpm.sock
file_server
https://caddyserver.com/docs/caddyfileby jacobtomlinson on 4/2/25, 9:02 AM
https://github.com/hashicorp/hcl?tab=readme-ov-file#informat...
by voodooEntity on 4/2/25, 9:09 AM
by Heliodex on 4/3/25, 12:31 AM
by juliangmp on 4/2/25, 9:59 AM
Though I'm not sure why using keywords like `true`, `false` or `null` are seen as a negative. Especially the numeral digits, its the system that most of the world uses...
by ryukoposting on 4/2/25, 12:49 PM
Blah blah blah it doesn't have a spec. Lack of a spec doesn't matter from the user's POV in this problem domain, as all configuration files are categorically application-specific anyway. It doesn't matter to the developer either, insofar as whatever implementation you use fits your needs. This isn't object notation, it's not data interchange, it's configuration.
by darccio on 4/2/25, 3:09 PM
by M95D on 4/2/25, 11:07 AM
In the "Material Definitions" example there are no { }. Why not? What's the difference? Is indentation significant?
by danielvaughn on 4/2/25, 10:14 AM
I abandoned the effort, but nice to know that someone else had a similar idea. Will be trying this out!
by eviks on 4/2/25, 12:54 PM
Are there any examples of what's possible with extensions?
by pbronez on 4/2/25, 12:14 PM
=====
Forbidden Characters
Forbidden characters are Unicode scalar values with general category Control, Surrogate, and Unassigned. Forbidden characters must not appear in the source text.
White Space
White space characters are those Unicode characters with the Whitespace property, including line terminators.
by tiffanyh on 4/2/25, 12:55 PM
Suggestion, might be good to include Lua in the comparison table - since it’s also used for config as well.
by xnorswap on 4/2/25, 12:29 PM
XML still works well as a configuration format.
Is it verbose? Very much so, but it ticks all the boxes:
- No ambiguity
- Typed
- Quick to parse
- Has Schemas that allow validation
- Widespread tooling support
All we needed was for applications to publish their XML schema files and any XML tool could allow for friendly editing.
by NuSkooler on 4/2/25, 2:14 PM
by protecto on 4/2/25, 9:54 AM
by mort96 on 4/2/25, 12:41 PM
This allows really cool things, like modular configs where one "main" config file can include multiple specific-purpose configs. One file can contain the "default users" while another can contain additional users, for example. Or each user can get its own file.
by kitd on 4/2/25, 8:55 AM
by sophronesis0 on 4/2/25, 1:07 PM
by jelder on 4/2/25, 11:25 AM
For example, you’ve reintroduced the Norway Problem. https://news.ycombinator.com/item?id=36745212
And I personally hope to never edit another file which lacks a strict schema like this does.
by jp57 on 4/2/25, 11:44 AM