This commit is contained in:
GitLab Deploy Bot
2025-10-21 23:45:13 +07:00
committed by Adnan Zahir
parent d41e16cab9
commit ad815b3412
3546 changed files with 4952546 additions and 30 deletions
+17
View File
@@ -0,0 +1,17 @@
package json
import (
"encoding/json"
)
// Codec implements the encoding.Encoder and encoding.Decoder interfaces for JSON encoding.
type Codec struct{}
func (Codec) Encode(v map[string]any) ([]byte, error) {
// TODO: expose prefix and indent in the Codec as setting?
return json.MarshalIndent(v, "", " ")
}
func (Codec) Decode(b []byte, v map[string]any) error {
return json.Unmarshal(b, &v)
}