MCPcopy Create free account
hub / github.com/buger/jsonparser / canonicalizeJSON

Function canonicalizeJSON

reference_oracle_test.go:336–342  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Comparison helpers — canonicalize both sides and compare bytes / values. --------------------------------------------------------------------------- canonicalizeJSON unmarshals and re-marshals bytes through encoding/json so

(b []byte)

Source from the content-addressed store, hash-verified

334// objects) compares equal. Returns the input unchanged on parse error so the
335// caller can decide how to react.
336func canonicalizeJSON(b []byte) ([]byte, error) {
337 var v interface{}
338 if err := json.Unmarshal(b, &v); err != nil {
339 return nil, err
340 }
341 return json.Marshal(v)
342}
343
344// compareGetToOracle compares jsonparser.Get's output to the expected Go
345// value (the reference oracle's prediction). Returns true iff they agree.

Callers 1

compareGetToOracleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected