One of the more appealing advantage of storing data in JSON rather than say sqlite is that it has potential to be properly versioned controlled via git. This cannot be leveraged upon as the current implementation stores the JSON data as a single line.
I would like to propose passing the JSON_PRETTY_PRINT
constant in the toJson
method during model saving so that it would pretty print the JSON. This would allow git to detect changed lines (single property inside the JSON) as opposed to replacing the whole collection should a merge conflict occur.
However this does increase the file size, if this is a concern, which it shouldn't be, you might want to expose this in the config file.
This would open up new possibilities and usecases for this package. Think of a team of devs working with a same set of versioned controlled JSON data without worrying much when a conflict occur.