I’ve very barely dipped my toes in dbus before, and the option to have something else is on its face attractive (not a fan of XML and the late 90s/early aughties style of oop), but JSON for a system interface?
I mean, Kubernetes shows that yaml can work, but in this day and age I’d expect several options for serialisation, and for the default to be binary, not strings.
String serialisations are primarily for humans IMO, either as readers or writers. As writers we want something with comments (and preferably no “find the missing }” game), so for that most of us would prefer something like TOML if the data is simple enough, and actually Yaml for complexity at the level of Kubernetes—JSON manages to be even more of a PITA at that level.
But machine-to-machine? Protobuf, cap’n’proto, postcard, even CBOR should all be alternatives to examine
JSON is not the optimal solution for either humans nor for machines… it’s a compromise in-between that is more complex to parse than most binary alternatives (and even some text-based ones, if the data can be represented in CSV tables for example), while also often requiring post-processing through beautifiers and similar to be able to visualize it cleanly for humans.
There are situations where it’s the format that makes the most sense… like in the web, where you are already working with javascript anyway. But it’s not a golden bullet to use everywhere.
Yeah, JSON is essentially a side effect of having JavaScript already. It makes sense that it shows up a lot of places, especially web. But just like with JS, it’s not really good, just ubiquitous.
I’ve very barely dipped my toes in dbus before, and the option to have something else is on its face attractive (not a fan of XML and the late 90s/early aughties style of oop), but JSON for a system interface?
I mean, Kubernetes shows that yaml can work, but in this day and age I’d expect several options for serialisation, and for the default to be binary, not strings.
String serialisations are primarily for humans IMO, either as readers or writers. As writers we want something with comments (and preferably no “find the missing
}
” game), so for that most of us would prefer something like TOML if the data is simple enough, and actually Yaml for complexity at the level of Kubernetes—JSON manages to be even more of a PITA at that level.But machine-to-machine? Protobuf, cap’n’proto, postcard, even CBOR should all be alternatives to examine
100%
JSON is not the optimal solution for either humans nor for machines… it’s a compromise in-between that is more complex to parse than most binary alternatives (and even some text-based ones, if the data can be represented in CSV tables for example), while also often requiring post-processing through beautifiers and similar to be able to visualize it cleanly for humans.
There are situations where it’s the format that makes the most sense… like in the web, where you are already working with javascript anyway. But it’s not a golden bullet to use everywhere.
Yeah, JSON is essentially a side effect of having JavaScript already. It makes sense that it shows up a lot of places, especially web. But just like with JS, it’s not really good, just ubiquitous.