Comment about key order

This commit is contained in:
Pieter Noordhuis 2024-10-28 16:21:32 +01:00
parent 4741593579
commit 3c3ef41588
No known key found for this signature in database
GPG Key ID: 12ACCCC104CF2930
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
// Marshal is a version of [json.Marshal] for [dyn.Value]. // Marshal is a version of [json.Marshal] for [dyn.Value].
// //
// Objects in the output retain the order of keys as they appear in the underlying [dyn.Value].
// The output does not escape HTML characters in strings. // The output does not escape HTML characters in strings.
func Marshal(v dyn.Value) ([]byte, error) { func Marshal(v dyn.Value) ([]byte, error) {
return marshalNoEscape(wrap{v}) return marshalNoEscape(wrap{v})
@ -16,6 +17,7 @@ func Marshal(v dyn.Value) ([]byte, error) {
// MarshalIndent is a version of [json.MarshalIndent] for [dyn.Value]. // MarshalIndent is a version of [json.MarshalIndent] for [dyn.Value].
// //
// Objects in the output retain the order of keys as they appear in the underlying [dyn.Value].
// The output does not escape HTML characters in strings. // The output does not escape HTML characters in strings.
func MarshalIndent(v dyn.Value, prefix, indent string) ([]byte, error) { func MarshalIndent(v dyn.Value, prefix, indent string) ([]byte, error) {
return marshalIndentNoEscape(wrap{v}, prefix, indent) return marshalIndentNoEscape(wrap{v}, prefix, indent)