Version 1
[yaffs-website] / vendor / drush / drush / commands / core / outputformat / json.inc
diff --git a/vendor/drush/drush/commands/core/outputformat/json.inc b/vendor/drush/drush/commands/core/outputformat/json.inc
new file mode 100644 (file)
index 0000000..7132d97
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * Output formatter 'json'
+ *
+ * @param $data
+ *   The $data parameter is converted to Javascript Object Notation
+ * @param $metadata
+ *   Unused
+ *
+ * Code:
+ *
+ *   return array(
+ *     "a" => array("b" => 2, "c" => 3),
+ *     "d" => array("e" => 5, "f" => 6)
+ *   );
+ *
+ * Output with --format=json:
+ *
+ *   {"a":{"b":2,"c":3},"d":{"e":5,"f":6}}
+ */
+class drush_outputformat_json extends drush_outputformat {
+  function format($input, $metadata) {
+    return drush_json_encode($input);
+  }
+}