This module contains procs for serialization and deseralization of arbitrary Nimrod data structures. The serialization format uses JSON.
Restriction: For objects their type is not serialized. This means essentially that it does not work if the object has some other runtime type than its compiletime type:
type TA = object TB = object of TA f: int var a: ref TA b: ref TB new(b) a = b echo($$a[]) # produces "{}", not "{f: 0}"
Procs
proc load[T](s: PStream; data: var T)
- loads data from the stream s. Raises EIO in case of an error.
proc store[T](s: PStream; data: T)
- stores data into the stream s. Raises EIO in case of an error.
proc `$$`[T](x: T): string
- returns a string representation of x.
proc to[T](data: string): T
- reads data and transforms it to a T.