Merge pull request #5037 from FedericoCeratto/patch-18
Add [un]marshalling examples
This commit is contained in:
commit
53f5f26c66
1 changed files with 7 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
## This module contains procs for `serialization`:idx: and `deseralization`:idx:
|
## This module contains procs for `serialization`:idx: and `deseralization`:idx:
|
||||||
## of arbitrary Nim data structures. The serialization format uses `JSON`:idx:.
|
## of arbitrary Nim data structures. The serialization format uses `JSON`:idx:.
|
||||||
|
## Warning: The serialization format could change in future!
|
||||||
##
|
##
|
||||||
## **Restriction**: For objects their type is **not** serialized. This means
|
## **Restriction**: For objects their type is **not** serialized. This means
|
||||||
## essentially that it does not work if the object has some other runtime
|
## essentially that it does not work if the object has some other runtime
|
||||||
|
|
@ -29,6 +30,12 @@
|
||||||
## a = b
|
## a = b
|
||||||
## echo($$a[]) # produces "{}", not "{f: 0}"
|
## echo($$a[]) # produces "{}", not "{f: 0}"
|
||||||
##
|
##
|
||||||
|
## # unmarshal
|
||||||
|
## let c = to[B]("""{"f": 2}""")
|
||||||
|
##
|
||||||
|
## # marshal
|
||||||
|
## let s = $$c
|
||||||
|
|
||||||
## **Note**: The ``to`` and ``$$`` operations are available at compile-time!
|
## **Note**: The ``to`` and ``$$`` operations are available at compile-time!
|
||||||
|
|
||||||
import streams, typeinfo, json, intsets, tables, unicode
|
import streams, typeinfo, json, intsets, tables, unicode
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue