mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-09-26 21:01:14 +08:00
17 lines
361 B
Go
17 lines
361 B
Go
// SPDX-FileCopyrightText: 2023-2025 Steffen Vogel <post@steffenvogel.de>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package tty
|
|
|
|
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)
|
|
}
|