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 f16b8a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,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 f16b8a9

Please sign in to comment.