Config Files: YAML vs JSON vs something else?

We will need config files once again.

Bukkit supported YAML config files while the Minecraft ressource pack system (and i guess the future Plugin API) uses JSON. Both of them basically store Arrays [1, 2, 3] and Maps {name: “Bob”, age: 16}. Both of them use a similar syntax (YAML parser usually understands JSON, JSON parser does not understand YAML)

YAML: (wikipedia)

(+) human-readable
(+) supports comments
(+) compatible with Bukkit
(+) advanced data types and anchors (never saw a plugin using it…)
(+) Wrapping text with >
(-) a lot can go wrong, not really beginner-friendly (no tabs, indent stuff)

JSON: (wikipedia)

(+) human-readable (maybe not as good as YAML)
(+) compatible with minecraft API?
(+) more languages support it, also web-browsers (so you can easily make a web-based config editor)
(+) Beginner friendly
(-) less features
(-) no comments
(-) More brackets [{…},{…},…]

Which one is better?
Before writing this post, i thought that JSON might be better than YAML, because it’s easier to write it.
I don’t know if the Bukkit YAML parser supported anchors and advanced data types, but if you use YAML in sponge, please support it :wink: The anchors, data types and comments (never thought about comments before) make me prefer YAML now, but JSON is still a good alternative (Minecraft API…)
What do you think?


It’s been mentioned that HOCON will be used (a derivative of JSON).


I vote for JSON.

I’m really into the HOCON idea, which is what I think Sponge will be going with configuration files. The basics are a lot like JSON. In fact, any JSON script would work in HOCON. One of the good additions I like in it mostly the flexibility, where you can use “=” instead of “:”, commas are not required, etc.

Yeah, I recently loved using yml, until recently, users of my plugins continually struggled with advanced configurations, most of the time it was due to indentation. I believe HOCON won’t care about indentation which should make it easier for users.

Exactly. I really like how clean YAML is, but in terms of power- compare it to plain JSON and I would prefer JSON. HOCON is the middle. They combined the power of plain JSON and readability of YAML. bootyful.

I think, if developers write an informational guide about writing config in JSON format, anybody can use JSON config

JSON. Position-dependent notation is bad and should be avoided, in my opinion.

Both! :smiley: Add support for YAML and JSON configs for flexibility.

I vote for Json but for a public plugin we need to use some simple configuration system like Yaml.

I also remembered HOCON will be used …

I disagree; we don’t need to support multiple configuration systems. That creates multiple points of maintenance that is unwarranted.

I prefer YAML… For me it is much more intuitive, it may contain comments and it has’nt brackets … Yes, ‘compatible with Minecraft API’… But I still prefer YALM

For me, JSON is much harder to write than YAML. However, if you choose JSON, please, make an online tool to verify the config file or even a built-in system which is called every time when plugin loads config file and writes to log possible errors without clearing file contents.

XML, maybe? TAML?

1 Like

HOCON has already been decided on.

Oh god not XML… That does not make it more readable… LOL

HOCON has been decided (AFAIK).

1 Like

Had to go digging up info about HOCON.

HOCON is the best option IMO. It’s been discussed in several places including on this PR

After looking at the spec and other resources, I agree. It’s very much like JSON, just easier to read and work with. And it looks to avoid the sins of YAML, which is all to the good in my estimation.