summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2012-12-11 22:15:50 +0100
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2012-12-11 23:08:09 +0100
commit545a7577e55597595a15c98a092f5e5da847c33e (patch)
tree5313ca03b2d3c280c129fd550f1b6dd49074391d /lib
parentd3eaddc961092d50bc02c2f5cdd3e940c876a3fc (diff)
downloadNim-545a7577e55597595a15c98a092f5e5da847c33e.tar.gz
Adds json usage example.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/pure/json.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index e7945eac3..cee135f08 100755
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -13,6 +13,23 @@
 ## (unlike XML). It is easy for machines to parse and generate.
 ## JSON is based on a subset of the JavaScript Programming Language,
 ## Standard ECMA-262 3rd Edition - December 1999.
+##
+## Usage example:
+##
+## .. code-block:: nimrod
+##  let
+##    small_json = """{"test": 1.3, "key2": true}"""
+##    jobj = parseJson(small_json)
+##  assert (jobj.kind == JObject)
+##  echo($jobj["test"].fnum)
+##  echo($jobj["key2"].bval)
+##
+## Results in:
+##
+## .. code-block:: nimrod
+##
+##   1.3000000000000000e+00
+##   true
 
 import 
   hashes, strutils, lexbase, streams, unicode