aboutsummaryrefslogtreecommitdiff
path: root/Command/Info.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-07-26 13:30:07 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-07-26 13:30:07 -0400
commit3eb54bb464b4566e5ea5fe9db5addc20231597d0 (patch)
tree265691703d3ee1c8f64dc6accc7dd0c30fbb3c3b /Command/Info.hs
parent4ee3e4194a716273f68641ba0312339ab7c70b8b (diff)
allow using Aeson for streaming JSON output
Keeping Text.JSON use for now, because it seems a better fit for most of the commands, which don't use very structured JSON objects, but just output whatever fields suites them. But this lets Aeson be used when a more structured data type is available to serialize to JSON.
Diffstat (limited to 'Command/Info.hs')
-rw-r--r--Command/Info.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Command/Info.hs b/Command/Info.hs
index 05d6a01d3..4eae57e5b 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -250,7 +250,7 @@ nostat = return Nothing
json :: JSON j => (j -> String) -> StatState j -> String -> StatState String
json fmt a desc = do
j <- a
- lift $ maybeShowJSON [(desc, j)]
+ lift $ maybeShowJSON $ JSONObject [(desc, j)]
return $ fmt j
nojson :: StatState String -> String -> StatState String
@@ -374,7 +374,7 @@ transfer_list :: Stat
transfer_list = stat desc $ nojson $ lift $ do
uuidmap <- Remote.remoteMap id
ts <- getTransfers
- maybeShowJSON [(desc, map (uncurry jsonify) ts)]
+ maybeShowJSON $ JSONObject [(desc, map (uncurry jsonify) ts)]
return $ if null ts
then "none"
else multiLine $