{"modulePath":"github.com/pb33f/libopenapi","version":"v0.45.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package jsonnode\n\nPackage jsonnode builds the yaml.Node tree for a JSON document directly, without running yaml's scanner.\n\nyaml parses JSON as a flow collection, and its scanner treats the opening '{' as a potential simple key, so it buffers every token of the document until the closing '}'. For a large JSON specification that is hundreds of megabytes of token queue. JSON's grammar is small enough to parse directly into the exact tree yaml would produce: the same kinds, tags, styles, values, lines and columns.\n\nParse only accepts input whose yaml parse it reproduces exactly. Anything else (invalid JSON, or valid JSON that yaml reads differently, such as a key separated from its colon by a line break) is declined, and the caller parses it with yaml instead, getting yaml's result or yaml's error.\n\n## Functions\n\n```go\nfunc Parse(data []byte) (*yaml.Node, bool)\n```\nParse returns the yaml document node yaml.Unmarshal produces for the JSON document in data, and true. It returns false when data is not a JSON object whose yaml parse it reproduces exactly.\n\n```go\nfunc ParseJSON(data []byte) (*yaml.Node, bool)\n```\nParseJSON builds a tree directly from authored JSON, including boolean roots, surrogate pairs, and JSON whitespace. Coordinates refer to the original bytes.\n\n```go\nfunc Unmarshal(data []byte, out *yaml.Node) error\n```\nUnmarshal decodes data into out, producing exactly what yaml.Unmarshal produces: a JSON object is built by Parse, and anything Parse declines is decoded by yaml.Unmarshal.\n\n","path":"github.com/pb33f/libopenapi/internal/jsonnode","name":"jsonnode","synopsis":"Package jsonnode builds the yaml.Node tree for a JSON document directly, without running yaml's scanner.","isRedistributable":true}
