Skip to content

Commit

Permalink
Fix deepObject marshalling losing json number format/precision
Browse files Browse the repository at this point in the history
  • Loading branch information
mgabeler-lee-6rs committed Jan 9, 2024
1 parent 35e8035 commit 8926e83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deepobject.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package runtime

import (
"bytes"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -71,8 +72,10 @@ func MarshalDeepObject(i interface{}, paramName string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to marshal input to JSON: %w", err)
}
e := json.NewDecoder(bytes.NewReader(buf))
e.UseNumber()
var i2 interface{}
err = json.Unmarshal(buf, &i2)
err = e.Decode(&i2)
if err != nil {
return "", fmt.Errorf("failed to unmarshal JSON: %w", err)
}
Expand Down

0 comments on commit 8926e83

Please sign in to comment.