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 ResponseRendering TemplateEngine 1 imports 1 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  59156f31_4d25_a3fa_1e2f_6a012e529835["json.go"]
  fefe783b_8987_7aed_66c9_b2860bfc32e7["bytes"]
  59156f31_4d25_a3fa_1e2f_6a012e529835 --> fefe783b_8987_7aed_66c9_b2860bfc32e7
  style 59156f31_4d25_a3fa_1e2f_6a012e529835 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package render

import (
	"bytes"
	"fmt"
	"html/template"
	"net/http"
	"unicode"

	"github.com/gin-gonic/gin/codec/json"
	"github.com/gin-gonic/gin/internal/bytesconv"
)

// JSON contains the given interface object.
type JSON struct {
	Data any
}

// IndentedJSON contains the given interface object.
type IndentedJSON struct {
	Data any
}

// SecureJSON contains the given interface object and its prefix.
type SecureJSON struct {
	Prefix string
	Data   any
}

// JsonpJSON contains the given interface object its callback.
type JsonpJSON struct {
	Callback string
	Data     any
}

// AsciiJSON contains the given interface object.
type AsciiJSON struct {
	Data any
}

// PureJSON contains the given interface object.
type PureJSON struct {
	Data any
}

var (
	jsonContentType      = []string{"application/json; charset=utf-8"}
	jsonpContentType     = []string{"application/javascript; charset=utf-8"}
	jsonASCIIContentType = []string{"application/json"}
)

// Render (JSON) writes data with custom ContentType.
func (r JSON) Render(w http.ResponseWriter) error {
	return WriteJSON(w, r.Data)
}

// ... (135 more lines)

Subdomains

Functions

Dependencies

  • bytes

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 ResponseRendering domain, TemplateEngine subdomain.
What functions are defined in json.go?
json.go defines 1 function(s): WriteJSON.
What does json.go depend on?
json.go imports 1 module(s): bytes.
Where is json.go in the architecture?
json.go is located at render/json.go (domain: ResponseRendering, subdomain: TemplateEngine, directory: render).

Analyze Your Own Codebase

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

Try Supermodel Free