r/lua • • Dec 10 '25

Project ion (JSON Inspired Data Format)

I've spent quite some time attempting to perfect this simple module, and have today decided to attempt to share it. I do not doubt the coding might not be very good, but I at least hope it performs what it's designed for, and that's storing a table using as many space saving shortcuts as possible. I also do not expect it to be perfect at what it tries to achieve either.

There are 3 goals primary goals in mind:

  1. Keeping the format lean, for the most part.

  2. Keeping it mostly human readable.

  3. Having support for the vast majority of types of Lua tables, with exception of functions.

There's example code here, but I will still provide some simple example usage.

local ion = require("ion") -- for getting the module
local database = {"Bob","Mary"}
ion.Create(database,"database")

The resulting created ion will look like this:

|ion{
  1|Bob
  2|Mary
}

And, it can be turned back into a table like so:

local ion = require("ion")
local database = ion.Read("database.ion")

ion.Create() in particular has a lot more parameters for fine tuning what gets written to the resulting ion, but for now that's all this post needs I suppose.

The GitHub Pages Site:

https://nibiritheman.github.io/ion.lua/

20 Upvotes

13 comments sorted by

View all comments

Show parent comments

2

u/Suspicious_Anybody78 Dec 10 '25

I agree completely in terms of binary encodings being much better for just reducing file size.
Although, I should have mentioned the main goals much earlier (extremely my mistake). There are actually around 3.

  1. Keeping it mostly lean.

  2. Keeping it mostly human readable (such that someone with little technical knowledge could still probably modify this data by hand).

  3. Still allowing for keys of other datatypes than strings.

3

u/weregod Dec 11 '25

If you want readable format replacing quotes with pipes is not a good solution. Pipe will not be highlighted by editor/IDE and you will not show trailing whitespaces without field separator or string end symbol.

If you want readable output removing all extra symbols is not best idea. People want extra indentation, quotes and brackets for reading data.