TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Jesth – Next-level human-readable data serialization format

38 pointsby alexrusticabout 2 years ago
Hi HN! I&#x27;m Alex, a tech enthusiast. I&#x27;m excited to show you Jesth, a next-level human-readable data serialization format.<p>This project started out as a markup language for writing the docstrings of functions that would ultimately be consumed by a documentation generator. Basically the idea was to split a docstring into sections like Description and Parameters. Each section would consist of a header in square brackets and a body (lines of text between two headers).<p>Here&#x27;s what a docstring for a sum function would look like:<p><pre><code> This function takes in two integers a and b and returns their sum. [parameters] - a: First integer - b: Second integer [return] Sum of a and b </code></pre> The Description section in the example above is actually an anonymous section, i.e., a section with an empty header.<p>Meanwhile, I was thinking of a way to automate part of my dev workflow by storing in a file commands grouped into tasks such as project creation, build, testing, release, et cetera. Similarly with the markup language for my documentation generator, I would use square brackets to define the tasks. Thus, a task would consist of a header and a body which would be a list of commands to be executed sequentially.<p>I built this project and named it Backstage. Here is a hypothetical backstage.tasks file:<p><pre><code> [release] &amp; test &amp; generate_doc &amp; git_stuff &amp; build # upload to PyPI $ twine upload --skip-existing dist&#x2F;* [git_stuff] $ git add . $ git commit -m {message} $ git push origin master </code></pre> The example above is illustrative only and would not work. It contains 2 sections &quot;release&quot; and &quot;git_stuff&quot;. Running the &quot;release&quot; task from the command line is equivalent to sequentially executing the commands in the &quot;release&quot; section.<p>The documentation generator and the scripting language, despite the obvious similarity in their formats, did not share any parsing code. So, to stop repeating myself, I created a file format and its library named Jesth which stands for &quot;Just Extract Sections Then Hack&quot;.<p>The library acts as an incomplete INI file parser that only hands the programmer the sections (as headers and their associated bodies which are lists of strings). No further interpretation of the data is done by the parser, allowing the programmer to unleash their creativity through useful hacks.<p>In its latest iteration, Jesth has matured and also includes a proper and extensively tested hack to convert a compatible section into a dictionary data structure, making Jesth my de facto preferred format for config files. I find Jesth more readable than TOML, YAML, and JSON.<p>Here, encoding a dictionary data structure in its own section with another section containing a prompt for ChatGPT:<p><pre><code> [prompt] I want you to act as a detective story writer. I will provide you with two dictionary data structures representing the profiles of two people. Your goal is to write a thrilling neo-noir story. My first request is: &quot;guess who the killer and victim is from the profiles, then build a story that includes every detail of the profiles&quot;. [profile] # This section can be converted into a dictionary data structure name = &#x27;Jane Doe&#x27; birthday = 2000-12-23Z10:17:37Z photo_jpg = (bin) VGhpcyBpcyBub3QgYSBwaG90by4uLiBCdXQgdGhhbmsgeW91 IGZvciB5b3VyIGludGVsbGVjdHVhbCBjdXJpb3NpdHkgOyk= --- books = (dict) romance = (list) &#x27;Happy Place&#x27; &#x27;Romantic Comedy&#x27; sci-fi = (list) &#x27;Dune&#x27; &#x27;Neuromancer&#x27; epitaph = (text) According to the law of conservation of energy, no a bit of you is gone; you are just less orderly. --- [profile] name = &#x27;John Doe&#x27; birthday = null books = (list) &#x27;American Predator&#x27; &#x27;Mindhunter: Inside the FBI&#x27;s Elite Serial Crime Unit&#x27; </code></pre> You can learn more by reading the project&#x27;s README and playing with the demo.<p>Let me know what you think of this project.

12 comments

chatmastaabout 2 years ago
This looks surprisingly nice, which is a high bar to clear when it comes to my opinion of new config file formats.<p>Am I understanding correctly that this basically adds a type system to TOML? Have you considered calling it TypeTOML and making it a superset of TOML? (Maybe this is covered in the readme which I only skimmed.)<p>It would be cool if I could rename `config.toml` to `config.ttoml` and add types as I need them, similarly to how I can rename `script.js` to `script.ts` for iterative adoption of TypeScript. Although obviously this would require the consuming code to implement the Jesth (TypeTOML?:)) parsing, which would maybe defeat the point of iteratively adopting it (why bother with partial compatibility then?). Perhaps you could make it a _compatible_ superset, with types implemented using TOML comments so that existing TOML parsers can parse an (untyped) structure from a Jesth file by ignoring the comments, while Jesth can parse a typed structure from the same file.
评论 #35996184 未加载
bath_about 2 years ago
How is the name of this project meant to be pronounced? &quot;jest h&quot; or &quot;jezzith&quot; are the first two things that come to mind (I&#x27;m not sure how to write out the second one phonetically)
评论 #35993392 未加载
ultrablackabout 2 years ago
This looks remarkably like the dosbox conf format. Im sure you have reinvented something from the 90s?<p><pre><code> [sdl] # fullscreen -- Start dosbox directly in fullscreen. # fulldouble -- Use double buffering in fullscreen. # fullresolution -- What resolution to use for fullscreen: original or fixed size (e.g. 1024x768). # windowresolution -- Scale the window to this size IF the output device supports hardware scaling. # output -- What to use for output: surface,overlay,opengl,openglnb,ddraw. # autolock -- Mouse will automatically lock, if you click on the screen. # sensitiviy -- Mouse sensitivity. # waitonerror -- Wait before closing the console if dosbox has an error. # priority -- Priority levels for dosbox: lowest,lower,normal,higher,highest,pause (when not focussed). # Second entry behind the comma is for when dosbox is not focused&#x2F;minimized. # mapperfile -- File used to load&#x2F;save the key&#x2F;event mappings from. # usescancodes -- Avoid usage of symkeys, might not work on all operating systems. fullscreen=false fulldouble=false fullresolution= windowresolution=2048x1536 output=ddraw autolock=false sensitivity=100 waitonerror=true priority=higher,normal mapperfile=mapper.txt usescancodes=true</code></pre>
评论 #35994476 未加载
评论 #35994277 未加载
alfalfasproutabout 2 years ago
First off, this is very cool! So don&#x27;t let my comments dissuade you...<p>But IME serialization tends to fall into two boats:<p>1. I want something akin to a config that&#x27;s human readable but very simple and I don&#x27;t want to think about strong typing 2. I&#x27;m serializing data and I want schemas, efficiency, etc.<p>I feel like (1) is pretty well handled by TOML and JSON and (2) is pretty well handled by flat&#x2F;proto buffers, thrift&#x2F;avro, capn&#x27; proto, etc.<p>I guess I&#x27;m wondering where you see this being used.
评论 #35994380 未加载
billconanabout 2 years ago
I&#x27;m looking for a good human readable format for my notebook app.<p>I don&#x27;t want to use markdown, because markdown is very difficult to parse and I can&#x27;t use existing parsers, because I want to extend markdown&#x27;s syntax to support extended content types and revisions.<p>(I&#x27;m currently using djot)<p>I also looked at structured format, like toml and hjson. What I don&#x27;t like about them is when the content contain a deep nested structure, the document will become unreadable.<p>for example, a blockquote can contain a paragraph and a paragraph can contain another blockquote and paragraph, etc<p>I can&#x27;t tell if your format is practical for deeply nested structures.
评论 #35992792 未加载
评论 #35991736 未加载
评论 #35993654 未加载
michaelteterabout 2 years ago
I&#x27;m not being negative, but I find it funny that this human readible serialization format has a name which is much less human readable than many other names.
robotvertabout 2 years ago
What about CUE? (<a href="https:&#x2F;&#x2F;cuetorials.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cuetorials.com&#x2F;</a>) It feels it&#x27;d solve your problem and more.
评论 #35999284 未加载
midnitewarriorabout 2 years ago
I can&#x27;t even pronounce the name, how am I going to read it?
评论 #35994397 未加载
miohtamaabout 2 years ago
After being frustrated with<p>- INI<p>- XML<p>- JSON<p>- YAML<p>- TOML<p>... I welcome our new Jesth overlords. Progress is unstoppable even if it happens in baby steps.
riku_ikiabout 2 years ago
I always thought prettified json looks very human readable.
评论 #35995147 未加载
评论 #35998690 未加载
Villain5875about 2 years ago
Does it feel like updated ini?
评论 #35999329 未加载
ramesh31about 2 years ago
Cool, so I see you&#x27;ve rediscovered S-Expressions.
评论 #35994364 未加载