json

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package json provide a library for working with JSON.

This is an extension to standard "encoding/json" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(in []byte) []byte

Escape the following character: `"` (quotation mark), `\` (reverse solidus), `\b` (backspace), `\f` (formfeed), `\n` (newline), `\r` (carriage return`), `\t` (horizontal tab), and control character from 0 - 31.

References:

* https://tools.ietf.org/html/rfc7159#page-8

func EscapeString

func EscapeString(in string) string

EscapeString escape the following character: `"` (quotation mark), `\` (reverse solidus), `\b` (backspace), `\f` (formfeed), `\n` (newline), `\r` (carriage return`), `\t` (horizontal tab), and control character from 0 - 31.

References

* https://tools.ietf.org/html/rfc7159#page-8

func ToMapStringFloat64

func ToMapStringFloat64(in map[string]interface{}) (out map[string]float64, err error)

ToMapStringFloat64 convert the map of string-interface{} into map of string-float64. This function convert the map's key to lower-cases and ignore zero value in interface{}. The interface{} value only accept basic numeric types and slice of byte.

func Unescape

func Unescape(in []byte, strict bool) (out []byte, err error)

Unescape JSON bytes, reversing what Escape function do.

If strict is true, any unknown control character will be returned as error. For example, in string "\x", "x" is not valid control character, and the function will return empty string and error. If strict is false, it will return "x".

func UnescapeString

func UnescapeString(in string, strict bool) (string, error)

UnescapeString unescape JSON string, reversing what EscapeString do.

If strict is true, any unknown control character will be returned as error. For example, in string "\x", "x" is not valid control character, and the function will return empty string and error. If strict is false, it will return "x".

Types

This section is empty.

Jump to

Keyboard shortcuts

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