2025-09-28 04:03:36 -04:00
|
|
|
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
|
|
//go:build !goexperiment.jsonv2
|
|
|
|
|
|
|
|
|
|
package json
|
|
|
|
|
|
|
|
|
|
import (
|
2026-04-10 22:18:18 +08:00
|
|
|
"encoding/json" //nolint:depguard // this package wraps it
|
2025-09-28 04:03:36 -04:00
|
|
|
"io"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func getDefaultJSONHandler() Interface {
|
2026-04-15 01:24:39 +08:00
|
|
|
return jsonV1{}
|
2025-09-28 04:03:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func MarshalKeepOptionalEmpty(v any) ([]byte, error) {
|
|
|
|
|
return DefaultJSONHandler.Marshal(v)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewDecoderCaseInsensitive(reader io.Reader) Decoder {
|
|
|
|
|
return DefaultJSONHandler.NewDecoder(reader)
|
|
|
|
|
}
|
2026-04-06 22:41:17 +02:00
|
|
|
|
|
|
|
|
type Value = json.RawMessage
|