Search packages, repositories and app categories

Package detailsv3.0.0

json_patch

Pure Dart utility package for the JSON Patch standard. Can apply patch operations as well as perform a diff algorithm on JSON-like objects.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
13.8K
Likes
25
Pub points
140

Install package

flutter pub add json_patch

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A pure Dart package implementing the JSON Patch standard, enabling safe modification of JSON-like objects through patch operations and generating diffs between two JSON structures. It supports common operations such as add, remove, replace, move, copy, and test, making it ideal for incremental updates in data synchronization or version control scenarios. The package is lightweight, platform-agnostic, and designed for use across Flutter and non-Flutter Dart projects.

Use cases

  • Real-time data synchronization
  • Version control for JSON documents
  • Incremental updates in APIs
  • Testing and validating JSON changes
  • Merging configuration files

Key features

  • Supports all standard JSON Patch operations
  • Generates diffs between JSON objects
  • Pure Dart implementation
  • Cross-platform compatibility
  • Lightweight and dependency-free

Suitable for

  • Developers working with dynamic JSON data
  • Applications requiring change tracking
  • APIs handling partial updates
  • Tools for data comparison and merging

Considerations

  • Not optimized for very large JSON structures
  • Requires manual handling of nested object paths
  • Limited error reporting for invalid patches

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

JSON Patch for Dart

A simple utility package for JSON Patch. Includes a simple diff algorithm as well as the ability to apply JSON Patch operations to a JSON-like Dart object.

Usage

import 'package:json_patch/json_patch.dart';

...

final ops = JsonPatch.diff(oldJson, newJson);
try {
    final patchedJson = JsonPatch.apply(json, patches, strict: false);
} on JsonPatchTestFailedException catch (e) {
    print(e);
}

See the example or the API docs for more information.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.