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

Fix minor typo + custom attributes for JSON syntax fix #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion 03-projects/01-first-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You want to split up your app in many different files. Let's say you have the fo
helper.go
```

What you are saying above is that your program consists of many files and that you want code in the fiile *main.go* to use code from *helper.go* for example.
What you are saying above is that your program consists of many files and that you want code in the file *main.go* to use code from *helper.go* for example.

To handle such a case, you need the following:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To handle such a case, you need the following:
Change a to the


Expand Down
30 changes: 15 additions & 15 deletions 04-webdev/01-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ So that means, we need to add the following annotations to our above created str

```go
type Product struct {
Id int `json: "id"`
Name string `json: "name"`
Id int `json:"id"`
Name string `json:"name"`
}

type Response struct {
Products []Product `json: "products"`
Products []Product `json:"products"`
}
```

What these annotations do is to say, in the JSON data, look for properties with these names and map them to the following property. Like in this example from above:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe annotations more in detail


```go
Id int `json: "id"`
Id int `json:"id"`
```

### Reading the data
Expand Down Expand Up @@ -151,12 +151,12 @@ import (
)

type Products struct {
Products []Product `json: products`
Products []Product `json:"products"`
}

type Product struct {
Id int `json: "id"`
Name string `json: "name"`
Id int `json:"id"`
Name string `json:"name"`
}

func main(){
Expand Down Expand Up @@ -193,8 +193,8 @@ import (
)

type Person struct {
Id int `json: "id"`
Name string`json: "name"`
Id int `json:"id"`
Name string`json:"name"`
}

func main() {
Expand Down Expand Up @@ -248,18 +248,18 @@ import (
)

type OrderItem struct {
Id int `json: "id"`
Quantity int `json: "quantity"`
Total float32 `json: "total"`
Id int `json:"id"`
Quantity int `json:"quantity"`
Total float32 `json:"total"`
}

type Order struct {
Id int `json: "id"`
Items []OrderItem `json: items`
Id int `json:"id"`
Items []OrderItem `json:"items"`
}

type Response struct {
Orders []Order `json: orders`
Orders []Order `json:"orders"`
}

func main() {
Expand Down