package json

import "github.com/gabriel-vasile/mimetype/internal/json"

Index

Constants

const (
	QueryNone = "json"
	QueryGeo  = "geo"
	QueryHAR  = "har"
	QueryGLTF = "gltf"
)
const (
	TokInvalid = 0
	TokNull    = 1 << iota
	TokTrue
	TokFalse
	TokNumber
	TokString
	TokArray
	TokObject
	TokComma
)

Functions

func LooksLikeObjectOrArray

func LooksLikeObjectOrArray(raw []byte) bool

LooksLikeObjectOrArray reports if first non white space character from raw is either { or [. Parsing raw as JSON is a heavy operation. When receiving some text input we can skip parsing if the input does not even look like JSON.

func Parse

func Parse(queryType string, raw []byte) (parsed, inspected, firstToken int, querySatisfied bool)

Parse will take out a parser from the pool depending on queryType and tries to parse raw bytes as JSON.

Source Files

parser.go

Version
v1.4.9 (latest)
Published
Apr 9, 2025
Platform
js/wasm
Imports
2 packages
Last checked
3 weeks ago

Tools for package owners.