json.inc

  1. 8.0.x commands/core/outputformat/json.inc
  2. 6.x commands/core/outputformat/json.inc
  3. 7.x commands/core/outputformat/json.inc
  4. master commands/core/outputformat/json.inc

Classes

Namesort descending Description
drush_outputformat_json Output formatter 'json'

File

commands/core/outputformat/json.inc
View source
  1. <?php
  2. /**
  3. * Output formatter 'json'
  4. *
  5. * @param $data
  6. * The $data parameter is converted to Javascript Object Notation
  7. * @param $metadata
  8. * Unused
  9. *
  10. * Code:
  11. *
  12. * return array(
  13. * "a" => array("b" => 2, "c" => 3),
  14. * "d" => array("e" => 5, "f" => 6)
  15. * );
  16. *
  17. * Output with --format=json:
  18. *
  19. * {"a":{"b":2,"c":3},"d":{"e":5,"f":6}}
  20. */
  21. class drush_outputformat_json extends drush_outputformat {
  22. function format($input, $metadata) {
  23. return drush_json_encode($input);
  24. }
  25. }