The link was indeed very helpful, so I used the following:
>From T to string:
result = ""
var t: T
var fromTtoString = cast[ptr array[sizeof(T), char]](unsafeAddr(t))[]
for c in fromTtoString: result.add(c)
Run
>From string to T:
var t: T = cast[ptr T](unsafeAddr(serializedStringData[stringIndex]))[]
Run
