diff --git a/basis/json/writer/writer-docs.factor b/basis/json/writer/writer-docs.factor index dab13883d8..e027e4d1c8 100644 --- a/basis/json/writer/writer-docs.factor +++ b/basis/json/writer/writer-docs.factor @@ -14,11 +14,11 @@ HELP: json-print $nl "Some options can control the formatting of the result:" { $table - { { $link json-allow-nans? } "Allow special floating-points: NaN, Infinity, -Infinity." } - { { $link json-friendly-keys? } "Convert - to _ in tuple slots and hashtable keys" } - { { $link json-coerce-keys? } "Coerce hashtable keys into strings" } - { { $link json-escape-slashes? } "Escape forward slashes inside strings" } - { { $link json-escape-unicode? } "Escape unicode values inside strings" } + { { $link json-allow-fp-special? } "Allow special floating-points: NaN, Infinity, -Infinity" } + { { $link json-friendly-keys? } "Convert - to _ in tuple slots and hashtable keys" } + { { $link json-coerce-keys? } "Coerce hashtable keys into strings" } + { { $link json-escape-slashes? } "Escape forward slashes inside strings" } + { { $link json-escape-unicode? } "Escape unicode values inside strings" } } } { $see-also >json } ; diff --git a/basis/json/writer/writer-tests.factor b/basis/json/writer/writer-tests.factor index de895d142b..8f46af197a 100644 --- a/basis/json/writer/writer-tests.factor +++ b/basis/json/writer/writer-tests.factor @@ -53,13 +53,13 @@ TUPLE: person first-name age ; [ H{ { json-null 1 } } >json ] unit-test { """{"Infinity":1}""" } -[ t json-allow-nans? [ H{ { 1/0. 1 } } >json ] with-variable ] unit-test +[ t json-allow-fp-special? [ H{ { 1/0. 1 } } >json ] with-variable ] unit-test { """{"-Infinity":1}""" } -[ t json-allow-nans? [ H{ { -1/0. 1 } } >json ] with-variable ] unit-test +[ t json-allow-fp-special? [ H{ { -1/0. 1 } } >json ] with-variable ] unit-test { """{"NaN":1}""" } -[ t json-allow-nans? [ H{ { NAN: 333 1 } } >json ] with-variable ] unit-test +[ t json-allow-fp-special? [ H{ { NAN: 333 1 } } >json ] with-variable ] unit-test { "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\"" diff --git a/basis/json/writer/writer.factor b/basis/json/writer/writer.factor index 7a99a69eb6..ec654299c1 100644 --- a/basis/json/writer/writer.factor +++ b/basis/json/writer/writer.factor @@ -5,8 +5,8 @@ io.streams.string json kernel locals math math.parser mirrors namespaces sequences strings tr words ; IN: json.writer -SYMBOL: json-allow-nans? -f json-allow-nans? set-global +SYMBOL: json-allow-fp-special? +f json-allow-fp-special? set-global SYMBOL: json-friendly-keys? t json-friendly-keys? set-global @@ -79,7 +79,7 @@ M: integer stream-json-print : float>json ( float -- string ) dup fp-special? [ - json-allow-nans? get [ json-error ] unless + json-allow-fp-special? get [ json-error ] unless { { [ dup fp-nan? ] [ drop "NaN" ] } { [ dup 1/0. = ] [ drop "Infinity" ] }