Home / File/ json.go — gin Source File

json.go — gin Source File

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

File go GinCore Middleware 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  d166a140_d073_47da_6615_97d59f62b01e["json.go"]
  7ffcec21_d2c2_c875_aec4_a048cedfa6dd["json"]
  d166a140_d073_47da_6615_97d59f62b01e --> 7ffcec21_d2c2_c875_aec4_a048cedfa6dd
  style d166a140_d073_47da_6615_97d59f62b01e 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 !jsoniter && !go_json && !(sonic && (linux || windows || darwin))

package json

import (
	"encoding/json"
	"io"
)

// Package indicates what library is being used for JSON encoding.
const Package = "encoding/json"

func init() {
	API = jsonApi{}
}

type jsonApi struct{}

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

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

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

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

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

Domain

Subdomains

Functions

Types

Dependencies

  • json

Frequently Asked Questions

What does json.go do?
json.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 json.go?
json.go defines 1 function(s): init.
What does json.go depend on?
json.go imports 1 module(s): json.
Where is json.go in the architecture?
json.go is located at codec/json/json.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