Skip to content

Commit db55e18

Browse files
committed
you're doing great
1 parent e51944e commit db55e18

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

040_json/08_unmarshal_tags/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ func main() {
2828
}
2929

3030
fmt.Println(data)
31+
fmt.Println(data[1].Kauai)
3132
}
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,50 @@
11
IN AN HTML FILE
2-
- create an array to hold objects in javascript. Each object should store a "Code" as in an number and "Descrip" as a string. The array should hold all of the objects. Create objects for the following HTTP status codes:
32

4-
StatusOK = 200
3+
Create an array to hold objects in javascript.
4+
5+
Each object should store a "Code" as in a number and "Descrip" as a string.
6+
7+
The array should hold all of the objects. Create objects for the following HTTP status codes:
58

9+
StatusOK = 200
610
StatusMovedPermanently = 301
711
StatusFound = 302
812
StatusSeeOther = 303
913
StatusTemporaryRedirect = 307
10-
1114
StatusBadRequest = 400
1215
StatusUnauthorized = 401
1316
StatusPaymentRequired = 402
1417
StatusForbidden = 403
1518
StatusNotFound = 404
1619
StatusMethodNotAllowed = 405
1720
StatusTeapot = 418
18-
1921
StatusInternalServerError = 500
2022

21-
- stringify that data to JSON
23+
Stringify that data to JSON
2224

23-
- display that JSON in the browser window
25+
Display that JSON in the browser window
2426

2527
IN A GO FILE
26-
- Create a variable with the identifier "rcvd" of type string. Store a raw string literal of the JSON created in the previous step as the value of the variable "rcvd".
2728

28-
- Unmarshal "rcvd" into a data structure with the identifier "data"
29+
Create a variable with the identifier "rcvd" of type string.
30+
31+
Store a raw string literal of the JSON created in the previous step as the value of the variable "rcvd".
32+
33+
Unmarshal "rcvd" into a data structure with the identifier "data"
34+
35+
Use a for range loop to iterate through "data" displaying the results to the terminal
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
2949

30-
- use a for range loop to iterate through "data" displaying the results to stdout
3150

0 commit comments

Comments
 (0)