]> gitweb.factorcode.org Git - factor.git/commitdiff
json: rename to json-coerce.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 28 Nov 2014 16:51:16 +0000 (08:51 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 28 Nov 2014 16:51:16 +0000 (08:51 -0800)
basis/json/writer/writer.factor

index 0832af0d16f2c57c84d84e25c3d200f2cf991384..7a99a69eb6b3b564c405de11dd2f30c0bf2d66b3 100644 (file)
@@ -105,13 +105,14 @@ M: sequence stream-json-print
 
 TR: json-friendly "-" "_" ;
 
-GENERIC: json-key ( obj -- str )
-M: f json-key drop "false" ;
-M: t json-key drop "true" ;
-M: json-null json-key drop "null" ;
-M: integer json-key number>string ;
-M: float json-key float>json ;
-M: real json-key >float number>string ;
+GENERIC: json-coerce ( obj -- str )
+M: f json-coerce drop "false" ;
+M: t json-coerce drop "true" ;
+M: json-null json-coerce drop "null" ;
+M: string json-coerce ;
+M: integer json-coerce number>string ;
+M: float json-coerce float>json ;
+M: real json-coerce >float number>string ;
 
 :: json-print-assoc ( obj stream -- )
     CHAR: { stream stream-write1 obj >alist
@@ -121,7 +122,7 @@ M: real json-key >float number>string ;
         first2 [
             dup string?
             [ _ [ json-friendly ] when ]
-            [ _ [ json-key ] when ] if
+            [ _ [ json-coerce ] when ] if
             stream stream-json-print
         ] [
             CHAR: : stream stream-write1