Documentation
¶
Overview ¶
Package jsonedit strictly decodes JSON edits onto live Go values without touching the edited value until the edit has succeeded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeStrict ¶
DecodeStrict decodes exactly one JSON value from data into dst, refusing unknown object fields and trailing data.
func Patch ¶
Patch strictly decodes data onto a copy of *cur and returns the edited value, leaving *cur and everything it refers to unchanged whether or not the decode succeeds.
The decode runs on a clone of *cur whose exported pointers, maps, slices and interfaces are freshly allocated, so a decode that fails halfway cannot reach the live value. The result then starts from a plain copy of *cur and takes from the decoded clone only the exported fields the patch changed, so unexported fields, fields tagged `json:"-"` and the identity of every pointer, map and slice the patch left alone survive. A field the patch changed holds a freshly allocated value. A type that implements json.Unmarshaler or encoding.TextUnmarshaler is taken whole from the decoded clone, because its own decoding may set fields Patch cannot see.
Types ¶
This section is empty.