From f98a497c404f2f94b72454440e7c00b709dd55e8 Mon Sep 17 00:00:00 2001 From: B4D_US3R Date: Thu, 30 Jan 2025 23:31:50 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=20=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..f1b2e21 --- /dev/null +++ b/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "log" + "net/http" +) + +type JsonInterface interface{} + +func getJson(url string) string { + resp, err := http.Get(url) + if err != nil { + log.Println(err) + } + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + return string(body) +} + +func unmJson(jsonString string) JsonInterface { + var decodedJson JsonInterface + err := json.Unmarshal([]byte(jsonString), &decodedJson) + if err != nil { + log.Println(err) + } + return decodedJson +} + +func main() { + fmt.Println(unmJson(getJson("https://pleroma.catgirls.asia/api/v1/instance"))) + +}