-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Parsing bug when there is whitespace before the closing } when parsing a variant type without specifying kind. When the kind is specified the problem goes away. This problem does not exist when parsing non-variant types.
I added eatSpace(s, i) after line 470 skipValue(s, i) which seems to avoid the problem in my case.
I should probably learn how to do pull requests...
Jsony 1.1.6
Nim 2.2.0
import jsony
type
JunkKind = enum jkJunkA
MyVariant = object
name: string
case kind: JunkKind
of jkJunkA: junkA: int
echo """{"name": "test1", "kind": "jkJunkA"}""".fromJson(MyVariant) # ok
echo """{"name": "test2", "kind": "jkJunkA" }""".fromJson(MyVariant) # ok
echo """{"name": "test3"}""".fromJson(MyVariant) # ok
echo """{"name": "test4" }""".fromJson(MyVariant) # fail: Expected , but got } instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels