I believe it was reported earlier as well (See #4273 and #4757 etc) but playground example for json encoding/decoding is not working again.
Steps to reproduce:
@Sparkenstein try paste the example to https://devbits.app/play
@nedpals wdym? https://devbits.app/play is Go playground not V
@Mikilis there's an option to switch to V as well.
Sample code to reproduce the issue:
import json
struct User {
name string
}
data := '{ "name": "Bob" }'
user := json.decode(User, data) or {
eprintln('Failed to decode json')
return
}
println(user.name)
Error displayed:
/vlib/json/json_primitives.v:8:3: error: To use @VROOT, you need to have a "v.mod" file in /vlib/json, or in one of its parent folders.
6 | #flag -I @VROOT/thirdparty/cJSON
7 | #flag @VROOT/thirdparty/cJSON/cJSON.o
8 | #include "cJSON.h"
| ~~~~~~~~~~~~~~~~
9 | #define js_get(object, key) cJSON_GetObjectItemCaseSensitive((object), (key))
10 | struct C.cJSON {
Can confirm the sample runs without errors on https://devbits.app/play.
Looks like duplicate of #3327 as well as #4892 - probably some of these could be closed.
Closing this as the old playground has been retired.