Skip to content

Commit

Permalink
Merge pull request #9 from Wifx/fix-json-extra-spaces
Browse files Browse the repository at this point in the history
Remove json marshall properties extra whitespaces and colons
  • Loading branch information
maltegrosse authored Dec 9, 2023
2 parents 0a970c0 + 145f8ec commit e9ad984
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
18 changes: 9 additions & 9 deletions Bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ type BearerIpConfig struct {
// MarshalJSON returns a byte array
func (bc BearerIpConfig) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Method": fmt.Sprint(bc.Method),
"Address": bc.Address,
"Prefix": bc.Prefix,
"Dns1: ": bc.Dns1,
"Dns2: ": bc.Dns2,
"Dns3: ": bc.Dns3,
"Gateway: ": bc.Gateway,
"Mtu": bc.Mtu,
"IpFamily: ": fmt.Sprint(bc.IpFamily)})
"Method": fmt.Sprint(bc.Method),
"Address": bc.Address,
"Prefix": bc.Prefix,
"Dns1": bc.Dns1,
"Dns2": bc.Dns2,
"Dns3": bc.Dns3,
"Gateway": bc.Gateway,
"Mtu": bc.Mtu,
"IpFamily": fmt.Sprint(bc.IpFamily)})
}

func (bc BearerIpConfig) String() string {
Expand Down
8 changes: 4 additions & 4 deletions Modem.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ type Port struct {
// MarshalJSON returns a byte array
func (po Port) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"PortName": po.PortName,
"PortType ": po.PortType,
"PortName": po.PortName,
"PortType": po.PortType,
})
}

Expand All @@ -340,8 +340,8 @@ type Mode struct {
// MarshalJSON returns a byte array
func (mo Mode) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"AllowedModes": mo.AllowedModes,
"PreferredMode ": mo.PreferredMode,
"AllowedModes": mo.AllowedModes,
"PreferredMode": mo.PreferredMode,
})
}

Expand Down
22 changes: 11 additions & 11 deletions Modem3gpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ type NetworkScanResult struct {
// MarshalJSON returns a byte array
func (nsr NetworkScanResult) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Networks": fmt.Sprint(nsr.Networks),
"LastScan ": nsr.LastScan,
"ScanDuration ": nsr.ScanDuration,
"Recent ": nsr.Recent,
"Networks": fmt.Sprint(nsr.Networks),
"LastScan": nsr.LastScan,
"ScanDuration": nsr.ScanDuration,
"Recent": nsr.Recent,
})
}

Expand All @@ -159,11 +159,11 @@ type Network3Gpp struct {
func (n Network3Gpp) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Status": fmt.Sprint(n.Status),
"OperatorLong ": n.OperatorLong,
"OperatorShort ": n.OperatorShort,
"OperatorCode ": n.OperatorCode,
"Mcc ": n.Mcc,
"Mnc ": n.Mnc,
"OperatorLong": n.OperatorLong,
"OperatorShort": n.OperatorShort,
"OperatorCode": n.OperatorCode,
"Mcc": n.Mcc,
"Mnc": n.Mnc,
"AccessTechnology": fmt.Sprint(n.AccessTechnology),
})
}
Expand All @@ -188,8 +188,8 @@ type RawPcoData struct {
func (r RawPcoData) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"SessionId": r.SessionId,
"Complete ": r.Complete,
"RawData ": r.RawData,
"Complete": r.Complete,
"RawData": r.RawData,
})
}

Expand Down
8 changes: 4 additions & 4 deletions ModemLocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func (cl CurrentLocation) MarshalJSON() ([]byte, error) {
return nil, err
}
return json.Marshal(map[string]interface{}{
"ThreeGppLacCi ": threeGppLacCiJson,
"GpsRaw ": gpsRawJson,
"GpsNmea ": gpsNmeaJson,
"CdmaBs ": cdmaBsJson,
"ThreeGppLacCi": threeGppLacCiJson,
"GpsRaw": gpsRawJson,
"GpsNmea": gpsNmeaJson,
"CdmaBs": cdmaBsJson,
})
}

Expand Down
2 changes: 1 addition & 1 deletion ModemManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type EventProperties struct {
func (ep EventProperties) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Action": ep.Action,
"Name ": ep.Name,
"Name": ep.Name,
"Subsystem": ep.Subsystem,
"Uid": ep.Uid,
})
Expand Down
4 changes: 2 additions & 2 deletions ModemTime.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ type ModemTimeZone struct {
func (mtz ModemTimeZone) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Offset": mtz.Offset,
"DstOffset ": mtz.DstOffset,
"LeapSeconds ": mtz.LeapSeconds,
"DstOffset": mtz.DstOffset,
"LeapSeconds": mtz.LeapSeconds,
})
}

Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (p Pair) pairToSlice() []interface{} {
func (p Pair) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"Left": p.GetLeft(),
"Right ": p.GetRight(),
"Right": p.GetRight(),
})
}

Expand Down

0 comments on commit e9ad984

Please sign in to comment.