json

package
v0.11.24 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-18 19:09:16 * @FilePath: \go-toolbox\pkg\json\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Marshal is exported by go-toolbox/json package.
	Marshal = json.Marshal
	// Unmarshal is exported by go-toolbox/json package.
	Unmarshal = json.Unmarshal
	// MarshalIndent is exported by go-toolbox/json package.
	MarshalIndent = json.MarshalIndent
	// NewDecoder is exported by go-toolbox/json package.
	NewDecoder = json.NewDecoder
	// NewEncoder is exported by go-toolbox/json package.
	NewEncoder = json.NewEncoder
)

Functions

func AppendKeysToJSONMarshal added in v0.11.12

func AppendKeysToJSONMarshal(originalJSON string, pairs *KeyValuePairs) ([]byte, error)

AppendKeysToJSONMarshal 将键值对追加到 JSON 中

func ReplaceKeys added in v0.11.3

func ReplaceKeys(data interface{}, oldStr, newStr string) (interface{}, error)

ReplaceKeys 替换 JSON 中的键(key)中的指定字符串为目标字符串

Types

type KeyValuePairs

type KeyValuePairs struct {
	// contains filtered or unexported fields
}

KeyValuePairs 是一个用于存储键值对的结构体

func NewKeyValuePairs

func NewKeyValuePairs() *KeyValuePairs

NewKeyValuePairs 创建一个新的 KeyValuePairs 实例

func (*KeyValuePairs) Add

func (kv *KeyValuePairs) Add(key string, value interface{}) *KeyValuePairs

Add 向 KeyValuePairs 中添加一个键值对

Jump to

Keyboard shortcuts

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