Replace Protobuf with JSON

Registered by Uwe Klotz on 2018-01-20

Protobuf is currently used for serializing complex data structures that don't need to be mapped to individual database columns. Instead the serialized value is stored as a base64-encoded BLOB in a single database column. Accessing, interpreting, and migrating those values is difficult if you don't have access to the .pb files and the generated (de-)serializer code:

https://www.mixxx.org/forums/viewtopic.php?f=3&t=9565

"Protobuf is portable and reasonably efficient, but very inflexible because it relies on generated code for (de-)serialization. Today I would simply use JSON for this purpose, even if it is less strict, has some runtime overhead, and requires compromises. Portability, interoperability, and transparency should be key!"

Further on the additional code generation step complicates the build process. This will be another obstacle if we decide to migrate to a decent build tool like Meson, I already tried it.

Reading and writing JSON is easy and can be accomplished by using a simple header-only library:
https://github.com/nlohmann/json

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Uwe Klotz
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

rryan (2018/9/12) Schema-less serialization formats are a maintenance nightmare, and parsing/generation of schema-less formats does not allow the use of the type system to prevent bugs. That's why I added protobuf in the first place even though JSON was available at the time. Versioning of fields is a first-class concept in protobuf, while JSON provides nothing to help you. Also, JSON is horribly bloated on the wire, protobuf is a quite efficient binary format.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.