News for hackers. Stuff that matters.
Re:Json-Base – Database built as JSON files by fanf2 on Thursday July 02, 2020 @11:00PM (#23720658)
1. Write your updates to a copy of the file.

1a. fsync() the file to ensure the contents are durable.

2. Do an atomic rename of that copy to the original.

2a. fsync() the directory to ensure the rename is durable.

Re:Json-Base – Database built as JSON files by fiddlerwoaroof on Friday July 03, 2020 @12:31AM (#23721024)
Or just use a database like SQLite or Postgres that has developers dedicated to solving this problem.