質問編集履歴
3
修正を加えました
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
type Error struct {
|
32
32
|
|
33
|
-
|
33
|
+
Errors []struct {
|
34
34
|
|
35
35
|
Code int `json:"code"`
|
36
36
|
|
2
正しいコードに適宜修正を加えました
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,9 +30,9 @@
|
|
30
30
|
|
31
31
|
type Error struct {
|
32
32
|
|
33
|
-
|
33
|
+
[]Errors struct {
|
34
34
|
|
35
|
-
Code
|
35
|
+
Code int `json:"code"`
|
36
36
|
|
37
37
|
Message string `json:"message"`
|
38
38
|
|
1
質問の意図がわかりやすいように修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
#現状
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -14,9 +14,17 @@
|
|
14
14
|
|
15
15
|
こんな感じのjsonで返ってきます
|
16
16
|
|
17
|
+
|
18
|
+
|
19
|
+
#質問
|
20
|
+
|
21
|
+
|
22
|
+
|
17
23
|
これの、codeの数字によって処理を変えたいんですが、どうしたらいいんでしょうか
|
18
24
|
|
19
25
|
|
26
|
+
|
27
|
+
#とりあえず
|
20
28
|
|
21
29
|
```go
|
22
30
|
|
@@ -24,9 +32,9 @@
|
|
24
32
|
|
25
33
|
errors struct {
|
26
34
|
|
27
|
-
|
35
|
+
Code string `json:"code"`
|
28
36
|
|
29
|
-
|
37
|
+
Message string `json:"message"`
|
30
38
|
|
31
39
|
} `json:"errors"`
|
32
40
|
|
@@ -37,7 +45,3 @@
|
|
37
45
|
|
38
46
|
|
39
47
|
jsonの形に合わせた構造体を作りました。
|
40
|
-
|
41
|
-
ですが、jsonがerror型なのでjson.Unmarshal()の第一引数にも入れられない
|
42
|
-
|
43
|
-
といった状況です
|