Skip to main content

normalize

Function normalize 

Source
pub fn normalize(base: &Value, candidate: &Value) -> Value
Expand description

Normalize a candidate document against a base document.

For every leaf path in base:

  • If the path is missing in candidate, copy the base value.
  • If the path exists as null, leave null (explicit deletion).
  • If the path exists with a value, leave unchanged.

Paths in candidate that do not exist in base are preserved (they represent additions).

ยงReturns

A new Value representing the normalized candidate.