bzflag icon indicating copy to clipboard operation
bzflag copied to clipboard

Add support for new data format in the API and possibly internally

Open allejo opened this issue 9 years ago • 6 comments

As per my discussion with blast, it would be nice to support a modern data format such as JSON at least in the API to replace the current .ini format that's very limited. I would like to suggest the json-c library, which is what I use in my League Overseer plugin, since it has a package on most Linux distributions as libjson0-dev or json-c-devel and it has support for Windows as well. Which library we choose is also up for discussion.

We would be able to use JSON internally for configuration files and other files as well. When to implement this whether for 2.4.x or 2.5.x is up for discussion.

/cc @blast007

allejo avatar Jun 11 '15 02:06 allejo

JSON is an abomination of a data format... it's a giant security hole for JavaScript (where it was invented) and Python, and not particularly pleasant for C++. I don't see any advantage to using it here.

jwmelto avatar Jun 11 '15 06:06 jwmelto

I think YAML would be a much better option to use for configuration files with JSON, since the latter doesn't support comments and is a bit hard to read and edit.

kongr45gpen avatar Jun 11 '15 20:06 kongr45gpen

If we're adding such a library, it should ideally be something that can be used not just for configuration files but data exchanges over HTTP, and should be something with wide language support (at least C/C++, Python, PHP, Perl). YAML might fit that, but I'd have to see how nice it is for something like the server list.

blast007 avatar Jun 12 '15 11:06 blast007

I agree with alezakos that YAML would be ideal for configuration files since they're far easier to read and can have comments, but I'm not sure how well YAML can be used for returning data for HTTP communication. I don't think I've ever seen a YAML REST API, I've always seen XML or JSON as the standard.

allejo avatar Jun 13 '15 18:06 allejo

You can actually use a YAML parser to read most JSON documents, although a JSON parser might be faster for that task.

kongr45gpen avatar Jun 14 '15 08:06 kongr45gpen