jsonx

package
v0.20.27 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoJSONCandidate = jsonrepair.ErrNoJSONCandidate

ErrNoJSONCandidate 表示文本中没有可修复的 JSON 片段。

Functions

func Candidates

func Candidates(text string) []string

Candidates 返回文本中可修复为合法 JSON 的候选片段。

func FormatIfJSON

func FormatIfJSON(text string) (string, bool)

FormatIfJSON 将合法 JSON 格式化;非 JSON 原样返回并标记为 false。

func RepairCandidate

func RepairCandidate(text string) (string, bool)

RepairCandidate 修复一个候选 JSON 片段;非对象或数组片段不作为结构化输出候选。

func UnmarshalFromTextStrict

func UnmarshalFromTextStrict(text string, target any) error

UnmarshalFromTextStrict 从非纯 JSON 文本中抽取并修复 JSON,再按目标结构严格解析。

func UnmarshalStrict

func UnmarshalStrict(data []byte, target any) error

UnmarshalStrict 解析可信 JSON 数据,并拒绝未知字段和尾随 JSON 值。

Types

This section is empty.

Jump to

Keyboard shortcuts

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