jsonrepair

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package jsonrepair is a vendored copy of github.com/kaptinlin/jsonrepair at v0.2.2 (MIT License — see the LICENSE file in this directory, Copyright (c) 2024 KaptinLin).

It is vendored rather than taken as a module dependency so that starlet keeps zero third-party dependencies and stays pinned to a release whose Go floor is 1.18/1.19; later jsonrepair releases raise the floor to go1.24. Only the runtime files are copied (const.go, errors.go, jsonrepair.go, utils.go) — the upstream test suite and its testify/yaml.v3 test dependencies are intentionally excluded. Do not edit these files by hand; re-vendor from the upstream tag to update.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedEnd       = errors.New("unexpected end of json string")
	ErrObjectKeyExpected   = errors.New("object key expected")
	ErrColonExpected       = errors.New("colon expected")
	ErrInvalidCharacter    = errors.New("invalid character")
	ErrUnexpectedCharacter = errors.New("unexpected character")
	ErrInvalidUnicode      = errors.New("invalid unicode character")
)

Predefined error variables for use with errors.Is()

Functions

func JSONRepair

func JSONRepair(text string) (string, error)

JSONRepair attempts to repair the given JSON string and returns the repaired version.

Types

type JSONRepairError

type JSONRepairError struct {
	Message  string
	Position int
	Err      error // optional underlying error
}

JSONRepairError represents a structured JSON repair error. It provides the error message, position, and optional underlying error

func (*JSONRepairError) Error

func (e *JSONRepairError) Error() string

Error implements the error interface

func (*JSONRepairError) Unwrap

func (e *JSONRepairError) Unwrap() error

Unwrap allows JSONRepairError to support errors.Is / errors.As

Jump to

Keyboard shortcuts

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