From 922cbebf8a93a2a1fceb9fa16ca57ec0dcf98c6a Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 28 Jul 2015 18:02:57 -0700 Subject: [PATCH] json.reader: enforce json> takes a string. --- basis/json/reader/reader.factor | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/basis/json/reader/reader.factor b/basis/json/reader/reader.factor index f46226531a..8028b507c8 100644 --- a/basis/json/reader/reader.factor +++ b/basis/json/reader/reader.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler ! See http://factorcode.org/license.txt for BSD license. -USING: arrays assocs combinators fry hashtables io -io.streams.string json kernel kernel.private math math.parser -namespaces sbufs sequences sequences.private strings vectors -math.order ; +USING: assocs combinators fry io io.streams.string json kernel +kernel.private math math.order math.parser namespaces sbufs +sequences sequences.private strings vectors ; IN: json.reader @@ -131,5 +130,7 @@ PRIVATE> : read-jsons ( -- objects ) input-stream get stream-json-read ; -: json> ( string -- object ) +GENERIC: json> ( string -- object ) + +M: string json> [ read-jsons first ] with-string-reader ;