jsoncompat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsoncompat holds the encoding/json/v2 options that keep this module's JSON readable and writable by encoding/json (v1) peers: the iap-authz issuer, the iap-tunnel server, and config and credential files written by releases built on v1. See CLAUDE.md, "JSON".

Index

Constants

This section is empty.

Variables

File is Write with the two-space indent of v1's MarshalIndent(v, "", " ").

Read is for decoding anything a v1 encoder may have written or a v1 decoder would have accepted. v2's stricter defaults would otherwise reject or misread legitimate input:

  • MatchCaseInsensitiveNames: v1 matched object names to struct fields case-insensitively ("Account" filled `json:"account"`); v2 by default ignores such a member silently.
  • AllowDuplicateNames: v1 accepted a repeated name (the last one wins); v2 by default fails the whole decode.
  • AllowInvalidUTF8: v1 replaced invalid UTF-8 in strings with U+FFFD; v2 by default fails the whole decode.

Unknown members are ignored by both versions; nothing is needed for them.

Write is for encoding anything a v1 decoder may read (the wire protocol) or that should stay byte-identical to what a v1 build wrote (config.json, credentials.json):

  • FormatNilSliceAsNull, FormatNilMapAsNull: v1 wrote a nil slice or map as null; v2 by default writes [] or {}.
  • Deterministic: v1 sorted map keys; v2 by default does not.
  • EscapeForHTML, EscapeForJS: v1 escaped <, >, & and U+2028/U+2029; both versions read either form, this only keeps the bytes the same.

omitempty differs too, but per field, not per call: v2 omits a field only when it would encode as null, "", {} or [], so a zero number or false is still written. Fields where v1's omitempty dropped 0 or false are tagged omitzero instead (v1 honours omitzero since Go 1.24).

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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