summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2016-11-19 20:40:35 +0100
committerGitHub <noreply@github.com>2016-11-19 20:40:35 +0100
commit53f5f26c66b50b9ccd222a6aa3d9698d490e6c55 (patch)
tree23e220940d602b04e9e2dca01eef568c51405f35
parentbeb44ef13dc60df45921b4f3bd9b557164c3d810 (diff)
parent0ce459ac5344da7cda28600349a1f369e2df76c4 (diff)
downloadNim-53f5f26c66b50b9ccd222a6aa3d9698d490e6c55.tar.gz
Merge pull request #5037 from FedericoCeratto/patch-18
Add [un]marshalling examples
-rw-r--r--lib/pure/marshal.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pure/marshal.nim b/lib/pure/marshal.nim
index 36e6cf52f..c4c731acf 100644
--- a/lib/pure/marshal.nim
+++ b/lib/pure/marshal.nim
@@ -9,6 +9,7 @@
 
 ## This module contains procs for `serialization`:idx: and `deseralization`: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
 ## essentially that it does not work if the object has some other runtime
@@ -29,6 +30,12 @@
 ##   a = b
 ##   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!
 
 import streams, typeinfo, json, intsets, tables, unicode