jsonp

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package jsonp JSONP 序列化操作

Index

Constants

View Source
const Mimetype = "application/javascript"

Variables

This section is empty.

Functions

func JSONP

func JSONP(callback string, data any) any

JSONP 返回 JSONP 对象

采用与 JSON 相同的解析方式。 callback 表示回调的函数名称,如果为空,则直接返回 data, 在输出时也将被当作普通的 JSON 输出。

func Marshal

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

Marshal 输出 JSONP 对象

v 如果是由 JSONP 构建的对象,则返回带 callback 的 js 函数; 如果是普通的对象,则采用 json.Marshal 将其转换成普通的 JSON 对象返回;

func Unmarshal added in v0.51.1

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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