]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/json/reader/reader-docs.factor
factor: trim using lists
[factor.git] / basis / json / reader / reader-docs.factor
index 488a7c6f8b4e6fb11dd93dd04f6985773c1de73b..dcfa153ae0f6b4d4eccfcd9d8a26b2e2cd1d0908 100644 (file)
@@ -1,18 +1,34 @@
 ! Copyright (C) 2006 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel ;
+USING: help.markup help.syntax ;
 IN: json.reader
 
 HELP: json>
 { $values { "string" "a string in JSON format" } { "object" "a deserialized object" } }
 { $description "Deserializes the JSON formatted string into a Factor object. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } ;
 
-HELP: read-jsons
-{ $values { "objects" "a vector of deserialized objects" } }
+HELP: read-json
+{ $values { "objects" { $sequence "deserialized objects" } } }
 { $description "Reads JSON formatted strings into a vector of Factor object until the end of the stream is reached. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } ;
 
+HELP: path>json
+{ $values
+    { "path" "a pathname string" }
+    { "json" "a JSON object" }
+}
+{ $description "Reads a file into a single JSON object. Throws an error if the file contains more than one json." } ;
+{ path>json path>jsons } related-words
+
+HELP: path>jsons
+{ $values
+    { "path" "a pathname string" }
+    { "jsons" { $sequence "JSON objects" } }
+}
+{ $description "Reads a file into a sequence of JSON objects and returns them all." } ;
+
 ARTICLE: "json.reader" "JSON reader"
 "The " { $vocab-link "json.reader" } " vocabulary defines a word for parsing strings in JSON format."
-{ $subsections json> read-jsons } ;
+"For more information, see " { $url "https://en.wikipedia.org/wiki/JSON" } "."
+{ $subsections json> read-json path>json path>jsons } ;
 
 ABOUT: "json.reader"