From 155b0a16ef3ac0019af7057ca619937e0505d2c3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 23 Oct 2015 18:22:24 -0400 Subject: [PATCH] =?UTF-8?q?Syntax=20nodes=E2=80=99=20JSON=20is=20unambiguo?= =?UTF-8?q?us.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prototype/Doubt/Syntax.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prototype/Doubt/Syntax.swift b/prototype/Doubt/Syntax.swift index 7f21673ca..fafcb71a8 100644 --- a/prototype/Doubt/Syntax.swift +++ b/prototype/Doubt/Syntax.swift @@ -105,11 +105,11 @@ extension Syntax { public func JSON(@noescape leaf leaf: A -> Doubt.JSON, @noescape recur: Recur -> Doubt.JSON) -> Doubt.JSON { switch self { case let .Leaf(a): - return leaf(a) + return [ "leaf": leaf(a) ] case let .Indexed(a): - return .Array(a.map(recur)) + return [ "indexed": .Array(a.map(recur)) ] case let .Keyed(d): - return .Dictionary(Dictionary(elements: d.map { ($0, recur($1)) })) + return [ "keyed": .Dictionary(Dictionary(elements: d.map { ($0, recur($1)) })) ] } } }