From 80744fe4f7c2194b8fdc39c5390108ef5b20de6e Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 19 Nov 2016 16:55:47 +0000 Subject: [PATCH 1/2] Add [un]marshalling examples --- lib/pure/marshal.nim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pure/marshal.nim b/lib/pure/marshal.nim index 36e6cf52fe..5eb8f7c1c4 100644 --- a/lib/pure/marshal.nim +++ b/lib/pure/marshal.nim @@ -29,6 +29,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 From 0ce459ac5344da7cda28600349a1f369e2df76c4 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 19 Nov 2016 18:52:28 +0000 Subject: [PATCH 2/2] Add marshal format warning --- lib/pure/marshal.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pure/marshal.nim b/lib/pure/marshal.nim index 5eb8f7c1c4..c4c731acf9 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