summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
authorDanil Yarantsev <tiberiumk12@gmail.com>2021-03-01 00:17:19 +0300
committerGitHub <noreply@github.com>2021-02-28 13:17:19 -0800
commit56461c280f78c55f538da7f382e1c2c308e04915 (patch)
treef98e1d9a440725e4bdf3f44a1694aec958299ff6 /lib/std
parent26a6ceb34eb2bfca4e39dec2dac2d0a2cdc1bade (diff)
downloadNim-56461c280f78c55f538da7f382e1c2c308e04915.tar.gz
Change stdlib imports to use std prefix in most examples (#17202)
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/jsonutils.nim16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/jsonutils.nim b/lib/std/jsonutils.nim
index d7d9600d1..bbe6a7cd4 100644
--- a/lib/std/jsonutils.nim
+++ b/lib/std/jsonutils.nim
@@ -280,7 +280,7 @@ proc fromJsonHook*[K, V](t: var (Table[K, V] | OrderedTable[K, V]),
   ## See also:
   ## * `toJsonHook proc<#toJsonHook>`_
   runnableExamples:
-    import tables, json
+    import std/[tables, json]
     var foo: tuple[t: Table[string, int], ot: OrderedTable[string, int]]
     fromJson(foo, parseJson("""
       {"t":{"two":2,"one":1},"ot":{"one":1,"three":3}}"""))
@@ -300,7 +300,7 @@ proc toJsonHook*[K, V](t: (Table[K, V] | OrderedTable[K, V])): JsonNode =
   ## See also:
   ## * `fromJsonHook proc<#fromJsonHook,,JsonNode>`_
   runnableExamples:
-    import tables, json
+    import std/[tables, json]
     let foo = (
       t: [("two", 2)].toTable,
       ot: [("one", 1), ("three", 3)].toOrderedTable)
@@ -316,7 +316,7 @@ proc fromJsonHook*[A](s: var SomeSet[A], jsonNode: JsonNode) =
   ## See also:
   ## * `toJsonHook proc<#toJsonHook,SomeSet[A]>`_
   runnableExamples:
-    import sets, json
+    import std/[sets, json]
     var foo: tuple[hs: HashSet[string], os: OrderedSet[string]]
     fromJson(foo, parseJson("""
       {"hs": ["hash", "set"], "os": ["ordered", "set"]}"""))
@@ -336,7 +336,7 @@ proc toJsonHook*[A](s: SomeSet[A]): JsonNode =
   ## See also:
   ## * `fromJsonHook proc<#fromJsonHook,SomeSet[A],JsonNode>`_
   runnableExamples:
-    import sets, json
+    import std/[sets, json]
     let foo = (hs: ["hash"].toHashSet, os: ["ordered", "set"].toOrderedSet)
     assert $toJson(foo) == """{"hs":["hash"],"os":["ordered","set"]}"""
 
@@ -350,7 +350,7 @@ proc fromJsonHook*[T](self: var Option[T], jsonNode: JsonNode) =
   ## See also:
   ## * `toJsonHook proc<#toJsonHook,Option[T]>`_
   runnableExamples:
-    import options, json
+    import std/[options, json]
     var opt: Option[string]
     fromJsonHook(opt, parseJson("\"test\""))
     assert get(opt) == "test"
@@ -368,7 +368,7 @@ proc toJsonHook*[T](self: Option[T]): JsonNode =
   ## See also:
   ## * `fromJsonHook proc<#fromJsonHook,Option[T],JsonNode>`_
   runnableExamples:
-    import options, json
+    import std/[options, json]
     let optSome = some("test")
     assert $toJson(optSome) == "\"test\""
     let optNone = none[string]()
@@ -385,7 +385,7 @@ proc fromJsonHook*(a: var StringTableRef, b: JsonNode) =
   ## See also:
   ## * `toJsonHook proc<#toJsonHook,StringTableRef>`_
   runnableExamples:
-    import strtabs, json
+    import std/[strtabs, json]
     var t = newStringTable(modeCaseSensitive)
     let jsonStr = """{"mode": 0, "table": {"name": "John", "surname": "Doe"}}"""
     fromJsonHook(t, parseJson(jsonStr))
@@ -403,7 +403,7 @@ proc toJsonHook*(a: StringTableRef): JsonNode =
   ## See also:
   ## * `fromJsonHook proc<#fromJsonHook,StringTableRef,JsonNode>`_
   runnableExamples:
-    import strtabs, json
+    import std/[strtabs, json]
     let t = newStringTable("name", "John", "surname", "Doe", modeCaseSensitive)
     let jsonStr = """{"mode": "modeCaseSensitive",
                       "table": {"name": "John", "surname": "Doe"}}"""