!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

424 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.140 Servers

Load older messages


SenderMessageTime
20 Mar 2026
* @piegames:flausch.socialpiegames sighs10:33:59
@piegames:flausch.socialpiegamesI hate JSON so fucking much10:34:03
@piegames:flausch.socialpiegamescurrently reading the I-JSON spec and got painfully reminded that JSON has zero non-text handling capabilities10:34:37
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)I recall there seemed to be some AWS endpoint that legitimately used duplicate keys too10:34:41
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)Though I’m not sure I can find the reference now10:35:15
@piegames:flausch.socialpiegames let me rephrase the question, are there any reasonable use cases for duplicate keys where parsing both and then using only one of the values is the correct behavior? 10:36:19
@emilazy:matrix.orgemilyit's sorta like asking if there's any use case for parsing web pages with invalid HTML the same way everyone else parses them10:37:24
@emilazy:matrix.orgemilythe use case is you can browse the web like everyone else10:37:36
@emilazy:matrix.orgemilythe documents are dodgy from an interoperability/sanity standpoint, but when they exist in the wild and everyone treats them the same way in practice…10:37:55
@qyriad:katesiria.orgQyriadUnfortunately retaining only one of the values is arguably a more compatible behavior because the alternative is e.g. parsing them into a list, which is an entirely different type10:38:10
@emilazy:matrix.orgemilyit's plausible you'd want the ability to get all the values of duplicated keys for some documents, but that's more in the territory of extending the language with more optional functionality than a reason to break stuff with the existing API10:38:32
@emilazy:matrix.orgemilyyeah, an alternate API would probably have to wrap every value in a list, or realistically you'd potentially care about the order too in that case, so just to a parse tree with lists of key, value pairs10:38:58
@emilazy:matrix.orgemilybut I doubt there's much demand for this10:39:04
@piegames:flausch.socialpiegamesyes, the reasonable alternative would be to have JSON objects only exposed as multimaps …10:39:07
@qyriad:katesiria.orgQyriad serde_json even emits duplicate keys, fuck me https://github.com/serde-rs/json/issues/1074 10:39:33
@piegames:flausch.socialpiegamesyes, that's why I said most duplicate keys are a sign of a mistake10:40:14
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them)
In reply to @emilazy:matrix.org
yeah, an alternate API would probably have to wrap every value in a list, or realistically you'd potentially care about the order too in that case, so just to a parse tree with lists of key, value pairs
Also could rename keys, like if you have duplicate key "a" it would become "a-0" and "a-1", but it's omega-cursed and also we think we have seen that in NixLang somewhere before
10:40:26
@piegames:flausch.socialpiegamesMurphy's law going strong there10:40:34
@qyriad:katesiria.orgQyriad Yeah, but parsing them into one value is likely to cause problems than parsing them into a composite structure 10:40:53
@qyriad:katesiria.orgQyriad * Yeah, but parsing them into one value is likely to cause fewer problems than parsing them into a composite structure 10:41:00
@qyriad:katesiria.orgQyriad We should almost definitely at least warn on this though 10:41:10
@piegames:flausch.socialpiegameshm, as in, runtime warning?10:41:30
@qyriad:katesiria.orgQyriadYes10:41:37
@piegames:flausch.socialpiegamesfucking hell10:44:41
@piegames:flausch.socialpiegamesthere is a rust crate called ijson10:44:45
@piegames:flausch.socialpiegames which has nothing to do with I_JSON, and is just "an opinionated fork of serde_json by a person whose name starts with i" 10:45:12
@qyriad:katesiria.orgQyriadOf course10:45:32
@coca162:matrix.orgCoca

All the rust json crates I already know of:

Input: {"name": "One", "name": "Two"}
serde_json (serde API): Err(Error("duplicate field `name`", line: 1, column: 22))
serde_json (Value API): Ok(Some(String("Two")))
nanoserde: Ok(Test { name: "Two" })
facet-json: Ok(Test { name: "Two" })
simd-json (serde API): Err(Error { index: 0, character: None, err_type: Serde("duplicate field `name`") })
simd-json (Value API): Ok(Some(Value([String("One")])))
10:46:07
@piegames:flausch.socialpiegames"internet json" surely wins the prize for the least searchable name of the week10:46:08
@coca162:matrix.orgCoca *

All the rust json crates I already know of:

Input: {"name": "One", "name": "Two"}
serde_json (serde API): Err(Error("duplicate field `name`", line: 1, column: 22))
serde_json (Value API): Ok(Some(String("Two")))
nanoserde: Ok(Test { name: "Two" })
facet-json: Ok(Test { name: "Two" })
simd-json (serde API): Err(Error { index: 0, character: None, err_type: Serde("duplicate field `name`") })
simd-json (Value API): Ok(Some(Value([String("One")])))
10:46:15

Show newer messages


Back to Room ListRoom Version: 10