1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: fix a broken example in json2's README.md (#16293)

This commit is contained in:
Taegon Kim 2022-11-03 02:29:43 +09:00 committed by GitHub
parent 5fe4888874
commit d4c83f62b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,8 +152,10 @@ fn (mut p Person) from_json(f json2.Any) {
``` ```
```v oksyntax ```v oksyntax
fn (mut p Person) to_json() string { import x.json2
obj := f.as_map()
fn (p Person) to_json() string {
mut obj := map[string]json2.Any{}
obj['nickname'] = p.name obj['nickname'] = p.name
return obj.str() return obj.str()
} }