json

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONPlugin

func NewJSONPlugin(logger *slog.Logger) model.ParserPlugin

NewJSONPlugin creates a new JSON language plugin

Types

type JSONPlugin

type JSONPlugin struct {
	// contains filtered or unexported fields
}

JSONPlugin implements language.Plugin for JSON files

func (*JSONPlugin) CanHandle

func (p *JSONPlugin) CanHandle(path string, info fs.FileInfo) bool

CanHandle determines if this plugin can process the given file

func (*JSONPlugin) Chunk

func (p *JSONPlugin) Chunk(content string, path string, opts *model.CodeChunkingOptions) ([]model.CodeChunk, error)

Chunk breaks JSON into semantic chunks based on structure

func (*JSONPlugin) Extensions

func (p *JSONPlugin) Extensions() []string

Extensions returns file extensions for JSON

func (*JSONPlugin) ExtractMetadata

func (p *JSONPlugin) ExtractMetadata(content string, path string) (model.FileMetadata, error)

ExtractMetadata extracts language-specific metadata from JSON content

func (*JSONPlugin) Name

func (p *JSONPlugin) Name() string

Name returns "json" as the language name

type JSONStructure

type JSONStructure struct {
	Type      string // object, array, primitive
	Key       string // for object properties
	Value     any    // the actual JSON value
	Children  []JSONStructure
	Path      string // JSON path like "users[0].name"
	LineStart int
	LineEnd   int
}

JSONStructure represents different types of JSON structures

Jump to

Keyboard shortcuts

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