How storing structured data in contract?


#1

We need to store user-struct into Contract.

like:

struct user_type {
    name   string
    age    uint
    father user_type
}

I found storage APIs, but value must be string type in current IOST blockchain javascript policy.

Which API can i call for do that ?

Mabye the which API can call like this

class permissions {
    init() {
        storage.put('master', {
            name:'super #su',
            permission:'active'
        })
    }

    update (name, newPermission) {
        let p = storage.get(name)
        assert(p != null, 'user not found')
        p.permission = newPermission
        storage.put(name, p)
    }
}