jsonclose

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package jsonclose closes truncated JSON documents: the state machine both the OutputDecoder's prefix salvage (partial_json.go) and mw.RepairJSON need. It lived as two hand-maintained copies until the 2026-09-22 0.3.0 review flagged that they had already drifted (the trailing-comma rule differed), and moves here rather than into either public package — THE-END-GOAL principle 3 names internal/ as the tool that keeps the guaranteed surface small, and Go's path-based internal rule lets both the root package and mw import it while third parties cannot (the adapterkit precedent).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(s string) (closed string, valid bool)

Close returns s closed over its open strings and brackets — structure only, never value content: a dangling escape is fixed so it cannot eat the closing quote, trailing commas are dropped, and a dangling colon gets a null. The attempt is handed back even when it still is not valid JSON (mw's payload-preservation rule: the bytes the caller sent survive byte-for-byte); valid reports whether it is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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