Why Flatpak choose JSON for configuration?

I’m trying to build my new application, CoBang with Flatpak. It is because many non-Ubuntu users ask me to distributed as Flatpak.

First step into it, I feel weird that Flatpak use JSON for configuration, given the fact than JSON doesn’t support comment, application developer cannot write down note for later reminding.

So, what is the reason that Flatpak author chose JSON?

No longer a concern, because Flatpak manifest supports YAML.

Note that if you want to use the flatpak manifest in Builder, we do not support the YAML format and probably wont be doing so unless someone really wants to abstract the file formats.

The JSON format that Flatpak uses does support comments. See json-glib for the implementation.

1 Like

But, that custom-format JSON is only supported by the Flatpak tools, not supported by text editors, where the comment is supposed to aim for. The comment is for human to read, and human use text editors to display them. Comment is meaningless to Flatpak tools, which simply just strip the comments when processing.

1 Like

Note that if you want to use the flatpak manifest in Builder, we do not support the YAML format and probably wont be doing so unless someone really wants to abstract the file formats.

YAML 1.2 is a superset of JSON, so perhaps you could replace the JSON parser with a YAML parser and use it to parse both formats?

Likely the comment syntax used for the custom “JSON” format breaks this approach.

It’s software, it can do everything. Whether somebody wants to replace the whole JSON parsing and generating code in Builder with a YAML-based parser/generator is another thing entirely. You may also need to write a good YAML library that integrates with GObject.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.