I prefer human-readable file formats

(adele.pollux.casa)

74 points | by Bogdanp 9 hours ago ago

64 comments

  • mxmlnkn 6 hours ago ago

    I concur with most of these arguments, especially about longevity. But, this only applies to smallish files like configurations because I don't agree with the last paragraph regarding its efficiency.

    I have had to work with large 1GB+ JSON files, and it is not fun. Amazing projects such as jsoncons for streaming JSONs, and simdjson, for parsing JSON with SIMD, exist, but as far as I know, the latter still does not support streaming and even has an open issue for files larger than 4 GiB. So you cannot have streaming for memory efficiency and SIMD-parsing for computational efficiency at the same time. You want streaming because holding the whole JSON in memory is wasteful and sometimes not even possible. JSONL tries to change the format to fix that, but now you have another format that you need to support.

    I was also contemplating the mentioned formats for another project, but they are hardly usable when you need to store binary data, such as images, compressed data, or simply arbitrary data. Storing binary data as base64 strings seems wasteful. Random access into these files is also an issue, depending on the use case. Sometimes it would be a nice feature to jump over some data, but for JSON, you cannot do that without parsing everything in search of the closing bracket or quotes, accounting for escaped brackets and quotes, and nesting.

    • jerf 4 hours ago ago

      My rule of thumb that has been surprisingly robust over several uses of it is that if you gzip a JSON format you can expect it to shrink by a factor of about 15.

      That is not the hallmark of a space-efficient file format.

      Between repeated string keys and frequently repeated string values, that are often quite large due to being "human readable", it adds up fast.

      "I was also contemplating the mentioned formats for another project, but they are hardly usable when you need to store binary data, such as images, compressed data, or simply arbitrary data."

      One trick you can use is to prefix a file with some JSON or other readable value, then dump the binary afterwards. The JSON can have offsets into the binary as necessary for identifying things or labeling whether or not it is compressed or whatever. This often largely mitigates the inefficiency concerns because if you've got a big pile of binary data the JSON bloat by percent tends to be much smaller than the payload; if it isn't, then of course I don't recommend this.

      • mxmlnkn 4 hours ago ago

        I can confirm usual compression ratios of 10-20 for JSON. For example, wikidata-20220103.json.gz is quite fun to work with. It is 109 GB, which decompresses to 1.4 TB, and even the non-compressed index for random access with indexed_gzip is 11 GiB. The compressed random access index format, which gztool supports, would be 1.4 GB (compression ratio 8). And rapidgzip even supports the compressed gztool format with further file size reduction by doing a sparsity analysis of required seek point data and setting all unnecessary bytes to 0 to increase compressibility. The resulting index is only 536 MiB.

        The trick for the mix of JSON with binary is a good reminder. That's how the ASAR file archive format works. That could indeed be usable for what I was working on: a new file format for random seek indexes. Although the gztool index format seems to suffice for now.

    • andreypopp 5 hours ago ago

      try clickhouse-local, it's amazing how it can crunch JSON/TSV or whatever at great speed

  • vermaden 5 minutes ago ago

    Me too.

    Especially in ASCIIDOC/HTML/TXT/PDF files - for PDF files also a copy of ODF/ODT for editing where possible.

    Then I can search for anything needed with grep(1) or pdfgrep(1) commands.

  • mriet 6 hours ago ago

    I can understand this for "small" data, say less than 10 Mb.

    In bioinformatics, basically all of the file formats are human-readable/text based. And file sizes range between 1-2Mb and 1 Tb. I regularly encounter 300-600 Gb files.

    In this context, human-readable files are ridiculously inefficient, on every axis you can think of (space, parsing, searching, processing, etc.). It's a GD crime against efficiency.

    And at that scale, "readable" has no value, since it would take you longer to read the file than 10 lifetimes.

    • graemep 5 hours ago ago

      I do not think the argument is that ALL data should be in human readable form, but I think there are far more cases of data being in a binary form when it would be better human readable. Your example of a case where it is human readable when it should be binary is rarer for most of us.

      In some cases human readable data is for interchange and it should be processed and queried in other forms - e.g. CSV files to move data between databases.

      An awful lot of data is small - and these days I think you can say small is quite a bit bigger than 10Mb.

      Quite a lot of data that is extracted from a large system would be small at that point, and would benefit from being human readable.

      The benefit of data being human readable is not necessarily that you will read it all, but that it is easier to read bits that matter when you are debugging.

    • attractivechaos 4 hours ago ago

      > human-readable files are ridiculously inefficient on every axis you can think of (space, parsing, searching, processing, etc.).

      In bioinformatics, most large text files are gzip'd. Decompression is a few times slower than proper file parsing in C/C++/Rust. Some pure python parsers can be "ridiculously inefficient" but that is not the fault of human-readability. Binary files are compressed with existing libraries. Compressed binary files are not noticeably faster to parse than compressed text files. Binary formats can be indeed smaller but space-efficienct formats take years to develop and tend to have more compatibility issues. You can't skip the text format phase.

      > And at that scale, "readable" has no value, since it would take you longer to read the file than 10 lifetimes.

      You can't read the whole file by eye, but you can (and should often) eyeball small sections in a huge file. For that, you need a human-readable file format. A problem with this field IMHO is that not many people are literally looking at the data by eye.

      • kaathewise 3 hours ago ago

        One of the problems is that a lot of bioinformatics formats nowadays have to hold so much data that most text editors stop working properly. For example, FASTA splits DNA data into lines of 50-80 characters for readability. But in FASTQ, where the '>' and '+' characters collide with the quality scores, as far as I know, DNA and the quality data are always put into one line each. Trying to find a location in a 10k long line gets very awkward. And I'm sure some people can eyeball Phred scores from ASCII, but I think they are a minority, even among researchers.

        Similarly, NEXUS files are also human-readable, but it'd be tough to discern the shape of inlined 200 node Newick trees.

        When I was asking people who did actual bioinformatics (well, genomics) what some of their annoyances when working with the bioinf software were, having to do a bunch of busywork on files in-between pipeline steps (compressing/uncompressing, indexing) was one of the complaints mentioned.

        I think there's a place in bioinformatics for a unified binary format which can take care of compression, indexing, and metadata. But with that list of requirements it'd have to be binary. Data analysis moved from CSVs and Excel files to Parquet, and I think there's a similar transition waiting to happen here

        • jltsiren 4 minutes ago ago

          My hypothesis is that bioinformatics favors text files, because open source tools usually start as research code.

          That means two things. First, the initial developers are rarely software engineers, and they have limited experience developing software. They use text files, because they are not familiar with the alternatives.

          Second, the tools are usually intended to solve research problems. The developers rarely have a good idea what the tools eventually end up doing and what data the files need to store. Text-based formats are a convenient choice, as it's easy extend and change them. By the time anyone understands the problem well enough to write a useful specification, the existing file format may already be popular, and it's difficult to convince people to switch to a new format.

    • mcdeltat 3 hours ago ago

      Another thing is human readable is typically synonymous with unindexed, which becomes a problem when you have large files and care about performance. In bioinformatics we often distribute sidecar index files with the actual data, which is janky and inefficient. Why not have a decent format to begin with?

      Further, when the file is unindexed it's even harder to read it as a human because you can't easily skip to a particular section. I have this trouble often where my code can efficiently access the data once it's loaded, but a human-eye check is tedious/impossible because you have to scroll through gigabytes to find what you want.

      • attractivechaos 2 hours ago ago

        > Another thing is human readable is typically synonymous with unindexed

        Indexing is not directly related to binary vs text. Many text formats in bioinformatics are indexed and many binary formats are not when they are not designed with indexing in mind.

        > a human-eye check is tedious/impossible because you have to scroll through gigabytes to find what you want.

        Yes, indexing is better but without indexing, you can use command line tools to extract the portion you want to look at and then pipe to "more" or "less".

  • zvr 22 minutes ago ago

    I see no issue using (or even receiving) an SQLite file, where I can see the tables structure and even export everything to pure text format.

    The major problem of both human-readable and binary formats is not the serialized form, but the understanding of the schema (structure) of the data, which more often than not, is completely undocumented. Human-readable formats are worse in this regard, because they justify it by "it's obvious what this is".

  • bregma 6 hours ago ago

    I journeyed from fancy commercial bookkeeping systems that changed data formats every few years (with no useful migration) to GNU Cash and finally to Plain-Text Accounting. I can finally get the information I need with easy backups (through VCS) and flexibility (through various tools that transform the data). The focus is on content, not tools or presentation or product.

    When I write I write text. I can transform text using various tools to provide various presentations consumable through various products. The focus is on content, not presentation, tools, or product.

    I prefer human-readable file formats, and that has only been reinforced over more than 4 decades as a computer professional.

    • gcarvalho 5 hours ago ago

      I have recently migrated ~8y of Apple Numbers spreadsheets (an annoyingly non-portable format) to plaintext accounting.

      It took me many hours and a few backtracks to get to a point where I am satisfied with it, and where errors are caught early. I would just suggest anyone starting now to enable --strict --pedantic on ledger-cli from the day 1, and writing asserts for your accounts as well e.g. to check that closed accounts don’t get new entries.

      I really miss data entry being easier and not as prone to free-form text editing errors (most common are typos on the amount or copying the wrong source/dest account), but I am confident it matches reality much better than my spreadsheets did.

  • kjellsbells 5 hours ago ago

    Ease of: reading, comprehension, manipulation, short- and long-term retrieval are not the same problems. All file formats are bad at at least one of these.

    Given an arbitrary stream of bytes, readability only means the human can inspect the file. We say "text is readable" but that's really only because all our tooling for the last sixty years speaks ASCII and we're very US-centric. Pick up a text file from 1982 and it could be unreadable (EBCDIC, say). Time to break out dd and cross your fingers.

    Comprehension breaks down very quickly beyond a few thousand words. No geneticist is loading up a gig of CTAGT... and keeping that in their head as they whiz up and down a genome. Humans have a working set size.

    Short term retrieval is excellent for text and a PITA for everything else. Raise your hand if you've gotten a stream of bytes, thrown file(1) at it, then strings(1), and then resorted to od or picking through the bytes.

    Long term retrieval sucks for everyone. Even textfiles. After all, a string of bytes has no intrinsic meaning except what the operating system and the application give it. So who knows if people in 2075 will recognise "48 65 6C 6C 6F 20 48 4E 21"?

    • wizzwizz4 5 hours ago ago

      I decoded that as "Hello HI!" using basic cryptanalysis, the assumption that the alphabet would be mostly contiguous, the assumption that capital and lower-case are separated by a bit, and the knowledge that 0x20 is space and 0x21 is exclamation mark. On a larger text, we wouldn't even need these assumptions: cryptanalysis is sufficiently-powerful, and could even reverse-engineer EBCDIC! (Except, it might be difficult to figure out where the punctuation characters go, without some unambiguous reference such as C source code: commas and question marks are easy, but .![]{} are harder.)

      Edit: I can't count. H and I are consecutive in the alphabet, and it actually says "Hello HN!". I think my general point is valid, though.

  • whobre 5 hours ago ago

    Even "human-readable" formats are only readable if you have proper tools - i.e. editors or viewers.

    If a binary file has a well-known format and tools available to view/edit it, I see zero problems with it.

  • nine_k 4 hours ago ago

    /* Technically, most binary formats are legible to a human, given a proper renderer, e.g. journalctl. What TFA speaks about is ASCII/UTF-8 text formats that need no processing besides rendering CR, LF, and TAB characters specially. Assuming a Unix command line, I would call these "cat-readable" formats, or maybe even "less-readable". */

  • graphviz 5 hours ago ago

    We learned the hard way, for some of us it's all too easy to make careless design errors that become baked-in and can't be fixed in a backward-compatible way (either at the DSL or API level). An example in Graphviz is its handling of backslash in string literals: to escape special characters (like quotes \"), to map special characters (like several flavors of newline with optional justification \n \l \r) and to indicate variables (like node names in labels \N) along with magic code that knows that if the -default- node name is the empty string that actually means \N but if a particular node name is the empty string, then it stays.

    There was a published study, Wrangling Messy CSV Files by Detecting Row and Type Patterns by Gerrit J. J. van den Burg, Alfredo Nazábal, and Charles Sutton (Data Mining and Knowledge Discovery, 2019) that showed many pitfalls with parsing CSV files found on GitHub. They achieved 97%. It's easy to write code that slings out some text fields separated by commas, with the objective of using a human-readable portable format.

    You can learn even more by allowing autofuzz to test your nice simple code to parse human readable files.

  • JdeBP 7 hours ago ago

    Given that the author mentions CSV and text table formats, the article's list of the "entire Unix toolchain" is significantly impoverished not only by the lack of ex (which is usefully scriptable) but by the lack of mlr.

    * https://miller.readthedocs.io/

    vis/unvis are fairly important tools for those text tables, too.

    Also, FediVerse discussion: https://social.pollux.casa/@adele/statuses/01K1VA9NQSST4KDZP...

    • hebocon 6 hours ago ago

      Wow, I've never heard of 'mlr' before. Looks like a synthesis of Unix tools, jq, and others? Very useful - hopefully it's packaged everywhere for easy access.

  • Too 5 hours ago ago

    Let’s say that hypothetically one were to disagree with this. What would be the best alternative format? One that has ample of tooling for editing and diffing, as though it was text, yet stores things more efficiently.

    Most of the arguments presented in TFA are about openness, which can still be achieved with standard binary formats and a schema. Hence the problem left to solve is accessibility.

    I’m thinking something like parquet, protobuf or sqllite. Despite their popularities, still aren’t trivial for anyone to edit.

    • kyrra 4 hours ago ago

      Protobuf has a text and binary format. https://protobuf.dev/reference/protobuf/textformat-spec/

      Google uses it a lot for data dumps for tests or config that can be put into source control.

    • aldonius 5 hours ago ago

      I suppose with SQLite files, you could at least in theory diff their SQL-dump representations, though you'd presumably want a way to canonicalise said representation. In a way I suppose each (VCS) commit is a bit like a database migration.

    • paulddraper 5 hours ago ago

      ZIP archive of XML is used for Office documents

  • kamatour 5 hours ago ago

    Readable files are great… until they’re 1TB and you just want to cry.

    • qiine 5 hours ago ago

      1TB of perfectly readable, human despair.

    • LoganDark 5 hours ago ago

      To be fair, nothing's great when I want to cry.

  • refactor_master 6 hours ago ago

    Clearly there’s a very real need for binary data formats, or we wouldn’t have them. For one, it’s much more space efficient. Does the author know how much storage cost in 1985? Or how slow computers were?

    If I time traveled back to 1985 and told corporate to adopt CSV because it’d be useful in 50 years when unearthing old customer records I’d be laughed out of the cigar lounge.

    • graemep 5 hours ago ago

      Except there are many things for which we used human readable formats in the 1980s for which we use binary formats now - HTTP headers, for example.

      CSV was definitely in wide use back then.

      Text formats are compressible.

      • self_awareness 5 hours ago ago

        Text formats are compressible because they waste a lot of space to encode data. Instead of the space of 256 values per byte they use maybe 100.

        • graemep 5 hours ago ago

          I assumed that is common knowledge here. The point is that you need to take that into account when discussing storage requirements.

          • self_awareness 3 hours ago ago

            So I guess it's also a common knowledge that a compressed stream needs to be uncompressed in order to use it. So argumenting that compressed stream takes smaller space on a floppy disk doesn't mean that it will also take the same amount of bytes in memory.

            Also I'd argue if HTTP1 can be treated as a pure text format, since it requires \r and \n as EOL markers, even on systems that only use \n. Strict binary requirements like this shouldn't be needed if it was a text protocol.

    • burnt-resistor 6 hours ago ago

      [flagged]

      • tliltocatl 5 hours ago ago

        It's often too late to overhaul you systems when performance becomes a serve limiting factor. By that point things like data format are already set in stone. The whole "premature optimization" was originally about peep-hole stuff, not architecture-defining concerns, and it's really sad to see it misapplied to "lets store everything as json and use O(n²) everywhere and hopefully it will be someone else's problem".

  • mschwaig 5 hours ago ago

    Human-readability was one of the aspects that I enjoyed about using CCL,the Categorical Configuration Language (https://chshersh.com/blog/2025-01-06-the-most-elegant-config...), in one of my projects recently.

    It saves you from escaping stuff inside of multiline-strings by using meaningful whitespace.

    What I did not like about CCL so much that it leaves a bunch of stuff underspecified. You can make lists and comments with it, but YOU have to decide how.

  • IanCal 6 hours ago ago

    > Unlike binary formats or database dumps, these files don't hide their meaning behind layers of abstraction. They're built for clarity, for resilience, and for people who like to know what's going on under the hood.

    Csv files hide their meaning in external documentation or someone’s head, are extremely unclear in many cases (is this a number or a string? A date?) and is extremely fragile when it comes to people editing them in text editors. They entirely lack checks and verification at the most basic level and worse still they’re often but not always perfectly line based. Many tools then work fine until they completely break you file and you won’t even know. Until I get the file and tell you I guess.

    I’ve spent years fixing issues introduced by people editing them like they’re text.

    If you’ve got to use tools to not completely bugger them then you might as well use a good format.

    • fireflash38 6 hours ago ago

      If you're reading in data, you need to parse and verify it anyway.

      • IanCal 6 hours ago ago

        Which you might not be able to do after it’s been broken silently.

        • fireflash38 5 hours ago ago

          That's still an issue with binary files too, and you can't even look at them to fix.

          • IanCal 2 hours ago ago

            Binary files are not usually edited by hand, and should not get broken without a broken parser or writer. There can be many more ways of fixing them too because it may not be as ambiguous as broken sv files.

    • burnt-resistor 6 hours ago ago

      They're standardized[0], so it's only stupid humans screwing them up.

      Maybe you need a database or an app rather than flat files.

      0. https://www.ietf.org/rfc/rfc4180.txt

      • IanCal 6 hours ago ago

        That came far after csv files started being used and many parsers don’t follow the spec. Even if they do, editing the file manually can easily and silent break it - my criticisms are of entirely valid to the new spec files. The wide range of ways people make csvs is a whole other thing I’ve spent years fixing.

        It’s not about the stupidity of the humans, and if it was then planning for “no stupid people” is even stupider than those messing up the files.

        > Maybe you need a database or an app rather than flat files.

        Flat files are great. What’s needed are good file formats.

        • knome 2 hours ago ago

          json makes for a great flat file format these days, with jq around to munge the data in it. csv is pretty bad for errors. mostly use it to dump data when I need to pass it to someone that will want to shove it in excel.

        • burnt-resistor 6 hours ago ago

          TOML

          What's the problem?

          • IanCal 6 hours ago ago

            What are you trying to ask? I don’t understand. I’m not talking about toml.

            • burnt-resistor 5 hours ago ago

              I gave you a good text file format. You're acting like there are no good file formats. Either invent a domain-specific one, use a standard one, or use a different modality rather than complain that a utopia you won't bother to create doesn't exist.

              • IanCal 2 hours ago ago

                Csv files are bad for many reasons, some of which are listed as positives in the article. I’m not talking about other formats.

          • integralid 5 hours ago ago

            But TOML is not a good file format. Quite the opposite actually.

            https://hitchdev.com/strictyaml/why-not/toml/

            • ioasuncvinvaer 4 hours ago ago

              I found that post unconvincing.

              > It's very verbose.

              This is his example: https://github.com/crdoconnor/strictyaml/blob/master/hitch/s...

              I think you shouldn't use yaml or toml for this.

              > TOML's hierarchies are difficult to infer from syntax alone

              True! The point of TOML is to flatten the hierarchical structures. I would argue your configuration files shouldn't have much nesting anyway.

              > Overcomplication: Like YAML, TOML has too many features

              Basically TOML has a date type and all associated problems and advantages. I think it's a reasonable thing to include.

              > Syntax typing

              I think this is a good thing. I want to know whether something is a string or a number.

      • Someone 6 hours ago ago

        > They're standardized[0]

        From that article:

        “This memo […] does not specify an Internet standard of any kind”

        and

        “Interoperability considerations:

        Due to lack of a single specification, there are considerable differences among implementations. Implementors should "be conservative in what you do, be liberal in what you accept from others" (RFC 793 [8]) when processing CSV files”

  • yinyang_in 4 hours ago ago

    It’s not about human-readable, it’s about standard format & available tooling to read for it. Be it .txt or json or yaml; standard format & tooling; digital content anyways isn’t human readable either digital interface.

  • adregan 5 hours ago ago

    Are there any binary formats that include the specification in the format itself?

  • codr7 5 hours ago ago

    I'll take sexprs over CSV/JSON/YAML/XML any day.

  • self_awareness 5 hours ago ago

    I'm not sure the author knows much about binary formats.

    Binary formats are binary for a reason. Speed of interpretation is one reason. Usage of memory is another reason. Directly mapping it and using it, is another reason. Binary formats can make assumptions about system memory page size. They can store internal offsets to make incremental reading faster. None of this is offered by text formats.

    Also, the ability to modify text formats is completely wrong. Nothing can be changed if we introduce checksums inside text formats. Also if we digitally sign a format, then nothing can be changed despite the fact that it's a text format.

    Also, comparing CSV files to internal database binary format? It's like comparing a book cover to the ERP system of a library. Meaning, it's comparing two completely different things.

  • rickcarlino 9 hours ago ago

    Do you have the Gemini:// URL? I’m getting a URL resolution error.

    • 7 hours ago ago
      [deleted]
    • rizky05 7 hours ago ago

      gemini://adele.pollux.casa/gemlog/2025-08-04_why_I_prefer_human-readble_file_formats.gmi

  • paulddraper 5 hours ago ago

    You want JARs to be human-readable? PNGs? MP3s?

    I think the author is thinking about a very narrow set of files.

  • ape4 5 hours ago ago

    Lets hear it for RTF for documents