xjson

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 1 Imported by: 0

README

xjson

JSON helper utilities for Go, intended as a small aggregator for CLI and debugging.

 

This package aims to collect reusable JSON manipulation helpers in one place. At the moment it only exposes a debug-oriented Dump function, but it is intended to grow into a broader collection of JSON utilities.


Purpose

xjson is designed to centralize JSON helper functions for command-line and utility code. The package currently focuses on debug serialization and readable JSON output, with the future goal of aggregating additional JSON manipulation utilities.


Installation

Use go get to add the package:

  go get github.com/AeonDigital/Go-Core/xjson@latest

Import it in your code:

import "github.com/AeonDigital/Go-Core/xjson"

Basic usage

Serialize a value to an indented JSON string for debugging:

output := xjson.Dump(myValue, "")
fmt.Println(output)

If the indentation string is empty, Dump defaults to two spaces.

output := xjson.Dump(myValue, "    ")

If marshaling fails, Dump returns a string containing the error message, which makes it safe for debug prints.


Supported APIs

Currently the package exposes:

  • xjson.Dump(v any, i string) string

This function is intended to provide a single consistent JSON dump helper while the package expands into a broader JSON utility collection.


External dependencies

xjson depends only on the Go standard library:

  • encoding/json

No third-party packages are required.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(v any, i string) string

Dump is a debugging utility that marshals the given value into an indented JSON string. It accepts any value (v) to be serialized and an indentation string (i), which defaults to two spaces (" ") if empty. Since it is intended for debugging, it swallows marshal errors and returns the error message string instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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