Reputation: 133
In my application, I am using a json file to persist the details in my application to use it in offline situation. Suppose if I serialize and save the data in my application and later point I need to update only one item in the json file.
In the above situation, is it possible to update only the delta change without overtiring the entire json back to the file.
Upvotes: 0
Views: 444
Reputation: 2117
Writing the whole file is the way this is usually accomplished. If you need to update a single config value then perhaps you should save your data to a database instead of a json text file. Redis, for example is a File based database and you could easily use it as the source of your application's configuration. This would allow you to make updates at the same level of granularity that you're looking for.
Upvotes: 1
Reputation: 6427
Only if the value and the replacement were the exact same size...
If you are saving enough data to make this a concern maybe JSON isn't the correct format to store it in, consider a database
Upvotes: 3