Home / Function/ WriteJSON() — gin Function Reference

WriteJSON() — gin Function Reference

Architecture documentation for the WriteJSON() function in json.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  43c93385_87da_6602_681c_4e71a7272473["WriteJSON()"]
  36497c4c_0d10_8cb8_75a4_12144878d10c["Render()"]
  36497c4c_0d10_8cb8_75a4_12144878d10c -->|calls| 43c93385_87da_6602_681c_4e71a7272473
  style 43c93385_87da_6602_681c_4e71a7272473 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

render/json.go lines 67–75

func WriteJSON(w http.ResponseWriter, obj any) error {
	writeContentType(w, jsonContentType)
	jsonBytes, err := json.API.Marshal(obj)
	if err != nil {
		return err
	}
	_, err = w.Write(jsonBytes)
	return err
}

Subdomains

Called By

Frequently Asked Questions

What does WriteJSON() do?
WriteJSON() is a function in the gin codebase.
What calls WriteJSON()?
WriteJSON() is called by 1 function(s): Render.

Analyze Your Own Codebase

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

Try Supermodel Free