gojson

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gojson generates go struct defintions from JSON documents

Reads from stdin and prints to stdout

Index

Constants

This section is empty.

Variables

View Source
var ForceFloats bool //nolint:gochecknoglobals

ForceFloats forces all numbers to be floats.

Functions

func FmtFieldName

func FmtFieldName(name string) string

FmtFieldName formats a string as a struct key

Example:

FmtFieldName("foo_id")/

Output: FooID.

func Generate

func Generate(input io.Reader, parser Parser, structName string, tags []string, subStruct bool, convertFloats bool) ([]byte, error)

Generate a struct definition given a JSON string representation of an object and a name structName.

func ParseJSON

func ParseJSON(input io.Reader) (any, error)

ParseJSON parses JSON input.

func ParseYAML

func ParseYAML(input io.Reader) (any, error)

ParseYAML parses YAML input.

Types

type Parser

type Parser func(io.Reader) (any, error)

Parser is a function that parses input into an interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL