OpenZFS 2.3-rc3 Adds JSON Output For Commonly Used Commands
Collapse
X
-
Originally posted by Old Grouch View Post
There are some people who would argue that that is quite a radical position, given the history of Unix, and the general habit of piping the output of one program into another for further processing.
IMHO JSON is not helpful in ad hoc work, but encourages those dubious integrations.
Leave a comment:
-
-
Originally posted by caligula View Post
Those claims are not true. If your data doesn't contain characters outside the ascii domain, json output can be pure 7-bit ascii. Also there are schema systems built on top of json. E.g. if you define the schema in high level typed language you can derive the serialization / deserialization process. Json serialization also doesn't require a full library. You can build a special purpose json serialization for a cmd line tool with just printf and some juggling.
Leave a comment:
-
-
Originally posted by Old Grouch View Post
Sigh. Fundamentally, all data can be represented by binary. Everything else is just a level of abstraction built on top, with compromises built in to the abstraction method.
The point about UTF-8 is that no-one is seriously proposing a new byte-level representation of character sets. You can point to problems, but the world has voted that it is good enough, bar a few exceptions, such as personal names written in obsolete Chinese characters, or artificially created character sets for academic/hobby-project languages.
The fact that people find the need to write articles like this .. tells you that being forced to do type conversion to use a data interchange format is insane. A standard data-interchange format needs a far richer set of representations of numeric data than JSON currently has, together with a way of defining exceptions/additions where needed.
JSON is just one of many serialized data-interchange formats (Wikipedia: Comparison of data-serialization formats) - and the mere fact that there is a plethora tells you that JSON is not the agreed 'standard' method. It can be improved upon, and really ought to be.
Leave a comment:
-
-
Originally posted by caligula View Post
Those claims are not true. If your data doesn't contain characters outside the ascii domain, json output can be pure 7-bit ascii. Also there are schema systems built on top of json. E.g. if you define the schema in high level typed language you can derive the serialization / deserialization process. Json serialization also doesn't require a full library. You can build a special purpose json serialization for a cmd line tool with just printf and some juggling.
The point about UTF-8 is that no-one is seriously proposing a new byte-level representation of character sets. You can point to problems, but the world has voted that it is good enough, bar a few exceptions, such as personal names written in obsolete Chinese characters, or artificially created character sets for academic/hobby-project languages.
As for JSON, it does not have distinct types for integers and floating-point values, which is less than useful. Naturally, one can remedy this by designing a higher-level schema that uses workarounds to represent different types in a JSON serialized way, but you only need to look at the differing implementations, and questions on how to achieve what 'ought' to be trivial tasks to realize that JSON + schema is insufficiently standard, or understood, even now.
The fact that people find the need to write articles like this:
Investigate JSON's numeric constraints, language inconsistencies, and precision errors, emphasizing Go-JavaScript and IEEE 754 format
tells you that being forced to do type conversion to use a data interchange format is insane. A standard data-interchange format needs a far richer set of representations of numeric data than JSON currently has, together with a way of defining exceptions/additions where needed.
JSON is just one of many serialized data-interchange formats (Wikipedia: Comparison of data-serialization formats) - and the mere fact that there is a plethora tells you that JSON is not the agreed 'standard' method. It can be improved upon, and really ought to be.
*To be fair, one can argue that Alonzo Church's lambda-calculus represents numbers in unary. People in general tend to be more familiar with binary, and Turing machines (which, ironically, often represent numbers in unary in examples), rather than with lambda-calculus.Last edited by Old Grouch; 11 November 2024, 10:45 AM. Reason: Edit to refer to Church (unary) numerals
Leave a comment:
-
-
Originally posted by Old Grouch View PostPersonally, I think it would be useful to have tools be able to provide output in a well-formed canonical output for use in subsequent processing. Having pretty much agreed on the use of UTF-8, it would be nice if we could agree on a workable (serialised) data representation. JSON is not it, for the reasons others have pointed out.
Leave a comment:
-
-
Originally posted by mb_q View PostCLI tools should not enforce bad behaviour of using them from other programs.
Personally, I think it would be useful to have tools be able to provide output in a well-formed canonical output for use in subsequent processing. Having pretty much agreed on the use of UTF-8, it would be nice if we could agree on a workable (serialised) data representation. JSON is not it, for the reasons others have pointed out.
I'm certainly not against the use of 'other methods'. Being able to use generic standard APIs for CLI tools would be excellent.
Leave a comment:
-
-
Originally posted by Old Grouch View PostGiven those apparent failings of JSON, and in the absence of OS APIs, what other data representation would you suggest?
Leave a comment:
-
-
Originally posted by mb_q View Post
Yeah, it just doesn't support integers and binary data (you cannot even represent arbitrary Linux path in JSON due to the fact that JSON requires UTF-8 and Linux doesn't) and there is no standard schema system and often no schema whatsoever, so the conversion still has to be manual. The robust solution for programmable administration is to use OS APIs in you language, not to autodrive CLI tools.
Leave a comment:
-
Leave a comment: