feat: Add support to import and export using URL param #63
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
It adds support to export and import the diff.
The exported data goes in the URL in the
d
query param.You can test the new functionality on this URL:
https://json-diff2.netlify.app?d=%7B%22left%22%3A%22%7B%5Cn%20%20%5C%22jsonShared%5C%22%3A%20true%2C%5Cn%20%20%5C%22version%5C%22%3A%20254%2C%5Cn%20%20%5C%22versionNonce%5C%22%3A%20179716985%5Cn%7D%22%2C%22right%22%3A%22%7B%5Cn%20%20%5C%22version%5C%22%3A%20254%2C%5Cn%20%20%5C%22newField%5C%22%3A%20%5C%22Hi%5C%22%2C%5Cn%20%20%5C%22versionNonce%5C%22%3A%20179716985%5Cn%7D%22%7D
Limitations
The maximum exportable difference size is constrained by the browser's maximum URL length, which is 4000 characters.
When it occurs, the app shows an alert notifying the error.
Though the limit seem short in JSON terms, some individuals, including myself, might find it useful for simple JSON data.
In case this PR don't gets merged, I deployed the app with this functionality on:
https://json-diff2.netlify.app