json: allow passing an anon struct as a decode type (#22228)

This commit is contained in:
Felipe Pena 2024-09-17 09:33:17 -03:00 committed by GitHub
parent 0c8ce3bcb9
commit 97c9f5f9e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 7 deletions

View file

@ -0,0 +1,9 @@
import json
fn test_main() {
json_text := '{ "a": "b" }'
b := json.decode(struct {
a string
}, json_text)!.a
assert dump(b) == 'b'
}