Skip to content

Commit

Permalink
chore: export MarshalIndent api in root
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Jul 8, 2024
1 parent 765ecdb commit ab80d06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ func Marshal(val interface{}) ([]byte, error) {
return ConfigDefault.Marshal(val)
}

// MarshalIndent is like Marshal but applies Indent to format the output.
// Each JSON element in the output will begin on a new line beginning with prefix
// followed by one or more copies of indent according to the indentation nesting.
func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
return ConfigDefault.MarshalIndent(v, prefix, indent)
}

// MarshalString returns the JSON encoding string of v.
func MarshalString(val interface{}) (string, error) {
return ConfigDefault.MarshalToString(val)
Expand Down

0 comments on commit ab80d06

Please sign in to comment.