mirror of
https://github.com/retailcrm/api-client-go.git
synced 2024-11-24 22:06:03 +03:00
UnmarshalJSON refactoring
This commit is contained in:
parent
3be09aff75
commit
56a053a61d
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ByID is "id" constant to use as `by` property in methods
|
// ByID is "id" constant to use as `by` property in methods
|
||||||
@ -383,7 +384,8 @@ func (v *OrderDeliveryData) UnmarshalJSON(b []byte) error {
|
|||||||
field := object.Field(i)
|
field := object.Field(i)
|
||||||
|
|
||||||
if i, ok := field.Tag.Lookup("json"); ok {
|
if i, ok := field.Tag.Lookup("json"); ok {
|
||||||
delete(additionalData, i[:len(i)-10])
|
name := strings.Split(i, ",")[0]
|
||||||
|
delete(additionalData, strings.TrimSpace(name))
|
||||||
} else {
|
} else {
|
||||||
delete(additionalData, field.Name)
|
delete(additionalData, field.Name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user