mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-10-04 08:26:48 +08:00
14 lines
248 B
Go
14 lines
248 B
Go
package util
|
|
|
|
import "encoding/json"
|
|
|
|
func ReIndentJSON(j []byte, prefix, indent string) ([]byte, error) {
|
|
u := map[string]any{}
|
|
|
|
if err := json.Unmarshal(j, &u); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return json.MarshalIndent(u, prefix, indent)
|
|
}
|