Skip to content

Getting Error: unhandled exception: sam.nim(93, 12) m.tokens[pos].kind == JSMN_OBJECT [AssertionDefect] #8

@treeform

Description

@treeform

Json trying to read:

{"active":true,"kind":"NODE","name":"node0","id":0,"kids":[{"active":true,"kind":"NODE","name":"node1","id":1,"kids":[]},{"active":true,"kind":"NODE","name":"node2","id":2,"kids":[]},{"active":true,"kind":"NODE","name":"node3","id":3,"kids":[]},{"active":true,"kind":"NODE","name":"node4","id":4,"kids":[]},null,null,null]}

Schema:

type Node = ref object
  active: bool
  kind: string
  name: string
  id: int
  kids: seq[Node]

Code:

  var node: Node = Node()
  node.loads(treeStr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions