jsondiff

moon add moonbit-community/jsondiff@0.1.2
Download zip
Version
0.1.2
License
Apache-2.0
Last updated
4 months ago
Downloads
25
README

#jsondiff

Simple Json Structrual Diff Library

///|
test {
let old : Json = { "foo": [1, 2, 3], "bar": { "baz": "qux" } }
let new : Json = {
"foo": [1, 2, 4],
"bar": { "baz": "quux" },
"new_key": true,
}
inspect(
JsonDiff::diff_string(old, new).unwrap(),
content=(
#| {
#|+ new_key: true
#| foo: [
#| 1
#| 2
#|- 3
#|+ 4
#| ]
#| bar: {
#|- baz: "qux"
#|+ baz: "quux"
#| }
#| }
),
)
}

#
JsonArrayEdit

type JsonArrayEdit

impl Eq for JsonArrayEdit

#
JsonDiff

type JsonDiff

Auxiliary structure to encapsulate data about the structural difference of two JSON files.

#
JsonDiff::diff

fn JsonDiff::diff(lhs : Json, rhs : Json, keys_only? : Bool) -> JsonDiff

Finds the JSON structural difference of two JSON files.

#
JsonDiff::diff_string

fn JsonDiff::diff_string(lhs : Json, rhs : Json, keys_only? : Bool, terminal? : Bool) -> String?

Finds the JSON structural difference of two JSON files and returns it as a formatted string.

#
JsonEdit

type JsonEdit

impl Eq for JsonEdit
impl Show for JsonEdit

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io