jsondiff

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package jsondiff computes small patches between two JSON values, so live components send what changed in a list instead of the whole list.

A patch is a list of operations, each a JSON array:

["s", path, value]                  set the value at path
["d", path]                         delete the object key at path
["a", path, start, deleteCount, items] splice the array at path

A path is a list of object keys and array indexes from the root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(raw []byte) (any, error)

Decode parses JSON for Diff, keeping numbers exact.

func Diff

func Diff(a, b any) [][]any

Diff returns the operations that turn a into b. It returns nil when they are equal, and a single set of the root when they differ entirely.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL