jsonclose

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 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 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.

func OpenString

func OpenString(s string) bool

OpenString reports whether s ends inside an open string — Close's own reading of it, so what follows the last quote is the string's content (mw.RepairJSON trims Unicode whitespace there only when it is not).

Types

This section is empty.

Jump to

Keyboard shortcuts

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