package
2.6.0+incompatible
Repository: https://github.com/square/go-jose.git
Documentation: pkg.go.dev

# README

Safe JSON

This repository contains a fork of the encoding/json package from Go 1.6.

The following changes were made:

  • Object deserialization uses case-sensitive member name matching instead of case-insensitive matching. This is to avoid differences in the interpretation of JOSE messages between go-jose and libraries written in other languages.
  • When deserializing a JSON object, we check for duplicate keys and reject the input whenever we detect a duplicate. Rather than trying to work with malformed data, we prefer to reject it right away.

# Functions

Compact appends to dst the JSON-encoded src with insignificant space characters elided.
HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029 characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029 so that the JSON will be safe to embed inside HTML <script> tags.
Indent appends to dst an indented form of the JSON-encoded src.
Marshal returns the JSON encoding of v.
MarshalIndent is like Marshal but applies Indent to format the output.
NewDecoder returns a new decoder that reads from r.
NewEncoder returns a new encoder that writes to w.
Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.

# Constants

unmarshal a JSON number into an interface{} as a float64.
unmarshal a JSON number into an interface{} as a int64 if value is an integer otherwise float64.
unmarshal a JSON number into an interface{} as a `json.Number`.

# Structs

A Decoder reads and decodes JSON objects from an input stream.
An Encoder writes JSON objects to an output stream.
An InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
Before Go 1.2, an InvalidUTF8Error was returned by Marshal when attempting to encode a string value with invalid UTF-8 sequences.
A SyntaxError is a description of a JSON syntax error.
An UnmarshalFieldError describes a JSON object key that led to an unexported (and therefore unwritable) struct field.
An UnmarshalTypeError describes a JSON value that was not appropriate for a value of a specific Go type.
An UnsupportedTypeError is returned by Marshal when attempting to encode an unsupported value type.

# Interfaces

Marshaler is the interface implemented by objects that can marshal themselves into valid JSON.
A Token holds a value of one of these types: Delim, for the four JSON delimiters [ ] { } bool, for JSON booleans float64, for JSON numbers Number, for JSON numbers string, for JSON string literals nil, for JSON null .
Unmarshaler is the interface implemented by objects that can unmarshal a JSON description of themselves.

# Type aliases

A Delim is a JSON array or object delimiter, one of [ ] { or }.
A Number represents a JSON number literal.
RawMessage is a raw encoded JSON object.