I have this object structure:
    
    
    type Item* = ref object
      path*: string
      tags*: seq[string]
    
    type DB* = object
      data*: Data
      items*: OrderedTable[string, Item]
    
    var db*: DB
    var original_jtext: string
    
    
    Run

I parse some json with:
    
    
    proc get_db*() =
      original_jtext = read_db_file()
      let db_json = parseJson(original_jtext)
      db = DB(data:to(db_json["data"], Data),
        items:to(db_json["items"], OrderedTable[string, Item]))
    
    
    Run

And it works fine, I can use the db object. Can iterate with for name in 
db.items.keys etc.

But when I try:

db.items.keys()

I get "Error: attempting to call routine: 'keys'"

The weird thing is that doing this works in the Playground, but not in my code. 
I wonder if I'm doing something wrong.

I tried renaming items to itemz, but same problem.

Reply via email to