this code will raise "You just found a bug. V can't compile this program, but it should. Please create a GitHub issue."
import json
println('ok')
the code from the example doesn't work:
import json
struct User {
name string
age int
}
data := '{ "name": "Frodo", "age": 25 }'
user := json.decode(User, data) or {
eprintln('Failed to decode json')
return
}
println(user.name)
println(user.age)
looks like str() has been removed?
@bitsnaps
I think duplicated with https://github.com/vlang/v/issues/361
@musou1500 still raise the same msg fatal error: 'json/cJSON/cJSON.c' file not found, looks like it still depends on cJSON
@bitsnaps Yes. json module depends on cJSON.
currently, you need to put cJSON library to the proper place.
of course, I think it should be fixed.
It seems there is a plan to remove cJSON dependency.
https://github.com/vlang/v/blob/b1553449d8e17f10560db3e39eec1c5278fe3eea/compiler/jsgen.v#L7
I created a PR. it will resolves this issue.