summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it.class b/it.class
index 9f5c44c..01527cd 100644
--- a/it.class
+++ b/it.class
@@ -1188,7 +1188,7 @@ static function file_get($filename, $p = array())
* @param $data data to write, string by default
* @param $p['keyval'] $data must be an assoc array and is written as tab-separated lines
* @param $p['lines'] write array of lines, appending newline
- * @param $p['json'] write array as json (prettyprints on devel)
+ * @param $p['json'] write array as json (prettyprints on devel or if value is "pretty")
* @param $p['mkdir'] create parent directory (one level)
* @param $p['cdist'] distribute saved file
* @return falsey for write errors
@@ -1202,7 +1202,7 @@ static function file_put($filename, $data, $p = array())
else if ($p['lines'])
$data = count((array)$data) ? implode("\n", (array)$data) ."\n" : "";
else if ($p['json'])
- $data = it::json_encode($data);
+ $data = it::json_encode($data, $p['json'] == "pretty" ? ['pretty' => true] : []);
if ($p['mkdir'] && $filename != "-")
@mkdir(dirname($filename));