by IgorPartola · 4y ago · 0 comments
"kb_read_s": 0.12
This worries me. JSON doesn’t have support for fixed point math, does it? When will some random POSIX tool spit out scientific notation at me.Also, if you just output a flat schema, is there much of a point in this vs just:
cpu: 0.2
kw_read_s: 0.12
The difference is that you can use a JSON parser vs splitting on new lines and colons?I do like the idea of JSON output as an option but before every bug and mistake gets canonized as POSIX or some other standard can we at least talk about the output format for a bit?
cpu: 0.2
kb_read_s: 0.12
mac_addr: 10:AA:FF:00:55:66 dict((key.strip(), val.strip()) for key, _, val in line.strip().partition(‘:’) for line in text.split(‘\n’) if line and line.strip())
Also who says we can’t have a universal parser for this format just like we have for JSON? Not everyone needs to write the one liner like above, just use the libtextformat.parse(text) or whatever we would call it. {program -> human-text -> parser}+
When it could look like this: program
-> {struct-text -> program}+
[-> formatter] -> human-text . json.parse(input)Type support is lacking. Not date support for example.
Unnecessary quotes around keys make it harder for humans to read.
Different implementations allow for repeated keys.
otherformat.parse(input) // just as reasonable cut -d: -f2-Plain text doesn't have support for numbers at all, which isn't much of a solution.
Let’s put it this way: if I proposed XML as the substitution for plain text, would you rather keep plain text or switch to XML?