jsonutil

package module
v0.0.0-...-d1c9056 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayFromFile

func ArrayFromFile(path string) ([]map[string]interface{}, error)

文件转JsonArray

func FormFile

func FormFile(path string, entity interface{}) (bool, string, interface{})

文件转换到结构

func JsonToMap

func JsonToMap(jsonStr string) (map[string]string, error)

json字符串转map

func MapFromFile

func MapFromFile(path string) (map[string]interface{}, error)

文件转map

func ToFile

func ToFile(data interface{}, path string) bool

转换json到文件

func ToMap

func ToMap(jsonStr string) (map[string]interface{}, error)

json字符串转map

func ToObj

func ToObj(str string, entity interface{}) (bool, string, interface{})

内容转换到结构实体

func ToStr

func ToStr(data interface{}) string

*

  • 对象转换到字符串
  • 直接使用json.Marshal存在转义问题,例如'&变成\u0026'

Types

This section is empty.

Jump to

Keyboard shortcuts

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