json

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJSON

func ExtractJSON(input string) []string

ExtractJSON extracts potential JSON blocks from the provided input string. The input string can either be raw JSON or markdown containing JSON code-blocks. The returned strings are sanitized. Codeblocks that do not contain valid JSON are ignored.

func ExtractQuotedBlocks

func ExtractQuotedBlocks(input string) []string

ExtractQuotedBlocks extracts blocks enclosed by ``` using a state machine.

func SanitizeJSONString

func SanitizeJSONString(input string) string

Types

type State

type State int
const (
	OutsideBlock State = iota
	InsideBlock
)

Jump to

Keyboard shortcuts

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