V: JSON encode/decode example in playground

Created on 21 Jun 2019  路  2Comments  路  Source: vlang/v

Running the JSON encoding/decoding example in the playground yields

You just found a bug. V can't compile this program, but it should. Please create a GitHub issue.

json_encoding_decoding

Bug

Most helpful comment

A smaller example of the bug:

import json
struct Test {
    s string
}
user := json.decode(Test, '{"s": "Frodo"}') or { return }
println(user.s)

Output:

`` needs to return ``

All 2 comments

A smaller example of the bug:

import json
struct Test {
    s string
}
user := json.decode(Test, '{"s": "Frodo"}') or { return }
println(user.s)

Output:

`` needs to return ``

Since the playground has been closed and the imports have been fixed, I will close this issue.

Was this page helpful?
0 / 5 - 0 ratings