r/PythonLearning • • Feb 22 '26

JSON vs TOON

Post image

Anyone have thoughts on this?

What’s your opinion on using a Toon-style JSON approach? Curious to hear different perspectives and real-world experiences.

1.3k Upvotes

167 comments sorted by

View all comments

21

u/[deleted] Feb 22 '26

Thoughts:

  • JSON is more readable where data is non-uniform (ie not like this example). In this situation TOON is good, but CSV would be better. TOON appears to work best when a mixture of uniform and non-uniform data is needed, a scenario which is unusual but perhaps not that unusual.

  • The standard for TOON is still evolving and not finalised. That may be an issue for long term support.

  • Compatibility is important. A lot of software has support for JSON and CSV. TOON is currently supported in the most popular languages, but not in some of the less popular ones.

  • Overall, what I'm seeing is not terrible. It's something I might consider using in future, for the right use case. It's not something I'm going to rush off and start using right away tho.

1

u/its_a_gibibyte Feb 26 '26

What about just JSON in a better layout:

{
 "Columns": ["id","name","role"],
  "data": [
    [1, "Alice", "admin"]
    [2, "Bob", "user"]
  ]
}

1

u/kozeljko Feb 26 '26

Why is "data" not aligned with "Columns" 🤢

1

u/its_a_gibibyte Feb 26 '26

Sure, you could also do:

{
  "data": [
    ["id","name","role"],
    [1, "Alice", "admin"],
    [2, "Bob", "user"]
  ]
}

1

u/robhanz Feb 26 '26

Eh I prefer the explicit columns element. That way there’s no “magic” row in the data collection you have to remember.