Home / File/ sonic.go — gin Source File

sonic.go — gin Source File

Architecture documentation for sonic.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go GinCore Middleware 1 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  78e09b41_64b5_6bb7_d162_c5d1615e6336["sonic.go"]
  0d816439_76ee_c7fb_5329_a059811a793a["io"]
  78e09b41_64b5_6bb7_d162_c5d1615e6336 --> 0d816439_76ee_c7fb_5329_a059811a793a
  style 78e09b41_64b5_6bb7_d162_c5d1615e6336 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2025 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

//go:build sonic && (linux || windows || darwin)

package json

import (
	"io"

	"github.com/bytedance/sonic"
)

// Package indicates what library is being used for JSON encoding.
const Package = "github.com/bytedance/sonic"

func init() {
	API = sonicApi{}
}

var json = sonic.ConfigStd

type sonicApi struct{}

func (j sonicApi) Marshal(v any) ([]byte, error) {
	return json.Marshal(v)
}

func (j sonicApi) Unmarshal(data []byte, v any) error {
	return json.Unmarshal(data, v)
}

func (j sonicApi) MarshalIndent(v any, prefix, indent string) ([]byte, error) {
	return json.MarshalIndent(v, prefix, indent)
}

func (j sonicApi) NewEncoder(writer io.Writer) Encoder {
	return json.NewEncoder(writer)
}

func (j sonicApi) NewDecoder(reader io.Reader) Decoder {
	return json.NewDecoder(reader)
}

Domain

Subdomains

Functions

Classes

Types

Dependencies

  • io

Frequently Asked Questions

What does sonic.go do?
sonic.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Middleware subdomain.
What functions are defined in sonic.go?
sonic.go defines 1 function(s): init.
What does sonic.go depend on?
sonic.go imports 1 module(s): io.
Where is sonic.go in the architecture?
sonic.go is located at codec/json/sonic.go (domain: GinCore, subdomain: Middleware, directory: codec/json).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free