jsonc

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToJSON

func ToJSON(src []byte) []byte

ToJSON strips out comments and trailing commas and convert the input to a valid JSON per the official spec: https://tools.ietf.org/html/rfc8259

The resulting JSON will always be the same length as the input and it will include all of the same line breaks at matching offsets. This is to ensure the result can be later processed by a external parser and that that parser will report messages or errors with the correct offsets.

func ToJSONInPlace

func ToJSONInPlace(src []byte) []byte

ToJSONInPlace is the same as ToJSON, but this method reuses the input json buffer to avoid allocations. Do not use the original bytes slice upon return.

Types

This section is empty.

Jump to

Keyboard shortcuts

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