Last updated:
0 purchases
json delta tool
A simple tool for calculating the delta (difference) between 2 json objects with the same schema.
Particulary useful for editing objects in UI - enabling save button if the edited object differs from the original, and sending a PATCH request to the backend using the delta method.
Features #
This tool includes 2 basic functionalities:
Check if 2 json objects differ
Subtract 2 json objects and get a json object with the difference.
Getting started #
flutter pub install json_delta
Usage #
Map<String, dynamic> person = {
'name': 'John Doe',
'age': 30,
'email': '[email protected]'
};
Map<String, dynamic> editedPerson = {
'name': 'John Doe',
'age': 30,
'email': '[email protected]'
};
// Output: true
print(JsonDelta.hasDelta(person, editedPerson));
// Output: {'email': '[email protected]'}
print(JsonDelta.delta(person, editedPerson));
copied to clipboard
Additional information #
This tool is intended for work with objects of the same schema.
For more detailed use cases see the examples.
Feel free to open issues in the GitHub repository.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.