Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2016-12-02 07:32:03 +0300
committerGitHub <noreply@github.com>2016-12-02 07:32:03 +0300
commit95dff7b6812f54c1afc67d6781a5d01d47c3ca60 (patch)
tree3c49147c490360c0d436dba0e1c9690d9978bd0b /plugins/API/Renderer/Json.php
parent28409d4c92f46ce3b250501c769bb08ebb26884c (diff)
parent59ba07cba11cd51a49ba5a4946abee0d34c4c7a9 (diff)
Merge pull request #10945 from piwik/3.x-dev3.0.0-b4
Piwik 3.0.0-b4 release
Diffstat (limited to 'plugins/API/Renderer/Json.php')
-rw-r--r--plugins/API/Renderer/Json.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/API/Renderer/Json.php b/plugins/API/Renderer/Json.php
index 8adfdaebe1..1f7591370b 100644
--- a/plugins/API/Renderer/Json.php
+++ b/plugins/API/Renderer/Json.php
@@ -17,9 +17,6 @@ use Piwik\ProxyHttp;
/**
* API output renderer for JSON.
*
- * **NOTE: This is the old JSON format. It includes bugs that are fixed in the JSON2 API output
- * format. Please use that format instead of this.**
- *
* @deprecated
*/
class Json extends ApiRenderer
@@ -61,7 +58,17 @@ class Json extends ApiRenderer
return $this->applyJsonpIfNeeded($result);
}
- return $this->renderDataTable($array);
+ $result = $this->renderDataTable($array);
+
+ // if $array is a simple associative array, remove the JSON root array that is added by renderDataTable
+ if (!empty($array)
+ && Piwik::isAssociativeArray($array)
+ && !Piwik::isMultiDimensionalArray($array)
+ ) {
+ $result = substr($result, 1, strlen($result) - 2);
+ }
+
+ return $result;
}
public function sendHeader()