Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove json marshall properties extra whitespaces and colons #9

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading