Source File
quote.go
Belonging Package
encoding/json/jsontext
// Copyright 2023 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build goexperiment.jsonv2package jsontextimport ()// AppendQuote appends a double-quoted JSON string literal representing src// to dst and returns the extended buffer.// It uses the minimal string representation per RFC 8785, section 3.2.2.2.// Invalid UTF-8 bytes are replaced with the Unicode replacement character// and an error is returned at the end indicating the presence of invalid UTF-8.// The dst must not overlap with the src.func [ ~[]byte | ~string]( []byte, ) ([]byte, error) {, := jsonwire.AppendQuote(, , &jsonflags.Flags{})if != nil {= &SyntacticError{Err: }}return ,}// AppendUnquote appends the decoded interpretation of src as a// double-quoted JSON string literal to dst and returns the extended buffer.// The input src must be a JSON string without any surrounding whitespace.// Invalid UTF-8 bytes are replaced with the Unicode replacement character// and an error is returned at the end indicating the presence of invalid UTF-8.// Any trailing bytes after the JSON string literal results in an error.// The dst must not overlap with the src.func [ ~[]byte | ~string]( []byte, ) ([]byte, error) {, := jsonwire.AppendUnquote(, )if != nil {= &SyntacticError{Err: }}return ,}
![]() |
The pages are generated with Golds v0.7.9-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |