From 9d97be7c15460746052c1ad5850988ac2784a79c Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 3 Nov 2019 01:56:42 +0900 Subject: [PATCH] Use standard library for JSON encoding --- arn/AniListMatch.go | 5 +++-- arn/KitsuMatch.go | 5 +++-- arn/MyAnimeListMatch.go | 5 +++-- arn/PushSubscription.go | 4 ++-- arn/Utils.go | 4 ++-- arn/stringutils/StringUtils.go | 4 ++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arn/AniListMatch.go b/arn/AniListMatch.go index 27f96744..18f1d4df 100644 --- a/arn/AniListMatch.go +++ b/arn/AniListMatch.go @@ -1,8 +1,9 @@ package arn import ( + "encoding/json" + "github.com/animenotifier/anilist" - jsoniter "github.com/json-iterator/go" ) // AniListMatch ... @@ -13,7 +14,7 @@ type AniListMatch struct { // JSON ... func (match *AniListMatch) JSON() string { - b, err := jsoniter.Marshal(match) + b, err := json.Marshal(match) PanicOnError(err) return string(b) } diff --git a/arn/KitsuMatch.go b/arn/KitsuMatch.go index 38f2fb02..0365e605 100644 --- a/arn/KitsuMatch.go +++ b/arn/KitsuMatch.go @@ -1,8 +1,9 @@ package arn import ( + "encoding/json" + "github.com/animenotifier/kitsu" - jsoniter "github.com/json-iterator/go" ) // KitsuMatch ... @@ -13,7 +14,7 @@ type KitsuMatch struct { // JSON ... func (match *KitsuMatch) JSON() string { - b, err := jsoniter.Marshal(match) + b, err := json.Marshal(match) PanicOnError(err) return string(b) } diff --git a/arn/MyAnimeListMatch.go b/arn/MyAnimeListMatch.go index f9bcc14e..20b54f72 100644 --- a/arn/MyAnimeListMatch.go +++ b/arn/MyAnimeListMatch.go @@ -1,8 +1,9 @@ package arn import ( + "encoding/json" + "github.com/animenotifier/mal" - jsoniter "github.com/json-iterator/go" ) // MyAnimeListMatch ... @@ -13,7 +14,7 @@ type MyAnimeListMatch struct { // JSON ... func (match *MyAnimeListMatch) JSON() string { - b, err := jsoniter.Marshal(match) + b, err := json.Marshal(match) PanicOnError(err) return string(b) } diff --git a/arn/PushSubscription.go b/arn/PushSubscription.go index 640b0c9c..2d7f828d 100644 --- a/arn/PushSubscription.go +++ b/arn/PushSubscription.go @@ -1,10 +1,10 @@ package arn import ( + "encoding/json" "net/http" webpush "github.com/akyoto/webpush-go" - jsoniter "github.com/json-iterator/go" ) // PushSubscription ... @@ -39,7 +39,7 @@ func (sub *PushSubscription) SendNotification(notification *PushNotification) (* } // Create notification - data, err := jsoniter.Marshal(notification) + data, err := json.Marshal(notification) if err != nil { return nil, err diff --git a/arn/Utils.go b/arn/Utils.go index 85d5d6bd..317a72e4 100644 --- a/arn/Utils.go +++ b/arn/Utils.go @@ -1,6 +1,7 @@ package arn import ( + "encoding/json" "errors" "flag" "fmt" @@ -17,7 +18,6 @@ import ( "github.com/akyoto/color" "github.com/animenotifier/kitsu" "github.com/animenotifier/mal" - jsoniter "github.com/json-iterator/go" shortid "github.com/ventu-io/go-shortid" ) @@ -139,7 +139,7 @@ func AgeInYears(birthDayString string) int { // JSON turns the object into a JSON string. func JSON(obj interface{}) string { - data, err := jsoniter.Marshal(obj) + data, err := json.Marshal(obj) if err == nil { return string(data) diff --git a/arn/stringutils/StringUtils.go b/arn/stringutils/StringUtils.go index 02b42b59..02afb1a3 100644 --- a/arn/stringutils/StringUtils.go +++ b/arn/stringutils/StringUtils.go @@ -1,12 +1,12 @@ package stringutils import ( + "encoding/json" "fmt" "strings" "unicode" "unicode/utf8" - jsoniter "github.com/json-iterator/go" "github.com/xrash/smetrics" ) @@ -97,7 +97,7 @@ func PrettyPrint(obj interface{}) { // Currently, MarshalIndent doesn't support tabs. // Change this back to using \t when it's implemented. // See: https://github.com/json-iterator/go/pull/273 - pretty, _ := jsoniter.MarshalIndent(obj, "", " ") + pretty, _ := json.MarshalIndent(obj, "", " ") fmt.Println(string(pretty)) }