diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2018-12-19 16:13:25 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-20 01:13:25 +0100 |
commit | 6cbe1d48d7717315e41b22a758357ceb24992fcd (patch) | |
tree | 9e285f45faf456b45c90f805e297ff2d068544d3 /lib/pure | |
parent | fc7df3283c11c71c60d079b5aea7deb70ffcb559 (diff) | |
download | Nim-6cbe1d48d7717315e41b22a758357ceb24992fcd.tar.gz |
[json] document fact that key ordering is preserved (#10020)
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/json.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 389df4087..010dd8f70 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -134,6 +134,13 @@ ## j2["details"] = %* {"age":35, "pi":3.1415} ## echo j2 +runnableExamples: + ## Note: for JObject, key ordering is preserved, unlike in some languages, + ## this is convenient for some use cases. Example: + type Foo = object + a1, a2, a0, a3, a4: int + doAssert $(%* Foo()) == """{"a1":0,"a2":0,"a0":0,"a3":0,"a4":0}""" + import hashes, tables, strutils, lexbase, streams, unicode, macros, parsejson |