json

package
v1.171.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

  • Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
  • SPDX-License-Identifier: Apache-2.0

Package json preserves the existing JSON import path.

Deprecated: Use github.com/ARM-software/golang-utils/utils/serialisation/json.

Index

Constants

This section is empty.

Variables

IsValidJSON validates JSON strings and byte slices.

JSONExtensions lists the file extensions considered JSON files.

Functions

func IsJSON

func IsJSON(extension string) bool

IsJSON reports whether an extension belongs to a JSON file.

func Marshal

func Marshal(v any) ([]byte, error)

Marshal encodes a value to JSON.

func MarshalWithContext

func MarshalWithContext(ctx context.Context, v any) ([]byte, error)

MarshalWithContext encodes a value to JSON with a context-aware encoder.

func ToYAML

func ToYAML(rawJSON []byte) ([]byte, error)

ToYAML converts JSON data to YAML.

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal decodes JSON into a destination value.

func UnmarshallWithContext

func UnmarshallWithContext(ctx context.Context, data []byte, v any) error

UnmarshallWithContext decodes JSON with a context-aware decoder.

Types

type Decoder

type Decoder = serialisation.Decoder

Decoder decodes successive JSON values from a reader.

func NewDecoder

func NewDecoder(ctx context.Context, r io.Reader) *Decoder

NewDecoder creates a context-aware JSON decoder.

type Encoder

type Encoder = serialisation.Encoder

Encoder writes successive JSON values to a writer.

func NewEncoder

func NewEncoder(ctx context.Context, w io.Writer) *Encoder

NewEncoder creates a context-aware JSON encoder.

Directories

Path Synopsis
jsontest
easyjson
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
ffjson
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
nofast
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.
* Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors.

Jump to

Keyboard shortcuts

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