]> gitweb.factorcode.org Git - factor.git/commitdiff
json.reader: rename read-json-objects to read-json.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 11 Dec 2020 23:37:53 +0000 (15:37 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 11 Dec 2020 23:37:53 +0000 (15:37 -0800)
basis/json/reader/reader-docs.factor
basis/json/reader/reader.factor

index 9d81b2018f5a32cae4fb63c891239e219dde51fa..06b2f3a18a1daf5858af8ea4941edbe867f0dc16 100644 (file)
@@ -7,12 +7,12 @@ 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-json-objects
-{ $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." } ;
 
 ARTICLE: "json.reader" "JSON reader"
 "The " { $vocab-link "json.reader" } " vocabulary defines a word for parsing strings in JSON format."
-{ $subsections json> read-json-objects } ;
+{ $subsections json> read-json } ;
 
 ABOUT: "json.reader"
index 8ba83882eef78a01bd74c0a3e81a4426d9fcbeb2..7d5e2e896c2339f7b604a3d2da6f886069faf135 100644 (file)
@@ -132,18 +132,18 @@ DEFER: (read-json-string)
 
 
 ! A properly formed JSON input should contain exactly one object with balanced brackets.
-: get-json-object ( objects  --  obj  )
+: get-json ( objects  --  obj  )
     dup length 1 = counter get 0 = and [ first ] [ json-error ] if ;
 
 PRIVATE>
 
-: read-json-objects ( -- objects )
+: read-json ( -- objects )
     input-stream get json-read-input ;
 
 GENERIC: json> ( string -- object )
 
 M: string json>
-    [ 0 counter [ read-json-objects get-json-object ] with-variable ] with-string-reader ;
+    [ 0 counter [ read-json get-json ] with-variable ] with-string-reader ;
 
 : path>json ( path -- json )
-    utf8 [ 0 counter [ read-json-objects get-json-object ] with-variable ] with-file-reader ;
+    utf8 [ 0 counter [ read-json get-json ] with-variable ] with-file-reader ;