Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
modify jsonDecode
Browse files Browse the repository at this point in the history
use before: 
user.ID is like 3.1431981e+06,

use after:
user.ID is 31431981
  • Loading branch information
qloog authored and danilopolani committed Jul 5, 2019
1 parent a7daeec commit 694de44
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gocialite.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,13 @@ func inSlice(v string, s []string) bool {
// Decode a json or return an error
func jsonDecode(js []byte) (map[string]interface{}, error) {
var decoded map[string]interface{}
if err := json.Unmarshal(js, &decoded); err != nil {
decoder := json.NewDecoder(strings.NewReader(string(js)))
decoder.UseNumber()

if err := decoder.Decode(&decoded); err != nil {
return nil, err
}

return decoded, nil
}

Expand Down

0 comments on commit 694de44

Please sign in to comment.