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

json: custom json field names with "[json:field_name]"

This commit is contained in:
Alexander Medvednikov
2019-08-23 02:54:39 +03:00
parent 7086547471
commit e39cb41d6b
3 changed files with 25 additions and 18 deletions

View File

@@ -645,6 +645,10 @@ fn (p mut Parser) struct_decl() {
if p.tok == .lsbr {
p.next()
attr = p.check_name()
if p.tok == .colon {
p.check(.colon)
attr += ':' + p.check_name()
}
p.check(.rsbr)
}
if attr == 'raw' && field_type != 'string' {