diff --git a/simpleAPI/simpleapi.php b/simpleAPI/simpleapi.php index 44002d3f01..1aa678ee0d 100644 --- a/simpleAPI/simpleapi.php +++ b/simpleAPI/simpleapi.php @@ -125,9 +125,14 @@ public function handleRequest() } // Einzelner Parameter: Raw-Output verwenden - echo $this->formatRawOutput($result); + echo $this->formatRawOutput($result, $paramName); } else { - echo json_encode($result); + // Für get_lastlivevaluesjson: JSON direkt ausgeben auch ohne raw=true + if (count($readParams) === 1 && array_keys($readParams)[0] === 'get_lastlivevaluesjson') { + echo $this->formatRawOutput($result, 'get_lastlivevaluesjson'); + } else { + echo json_encode($result); + } } return; } @@ -481,12 +486,17 @@ private function getSuccessMessage($param, $value, $chargepointId) /** * Raw-Ausgabe formatieren */ - private function formatRawOutput($data) + private function formatRawOutput($data, $paramName = null) { if (is_array($data)) { $firstKey = array_keys($data)[0]; $firstValue = $data[$firstKey]; + // Für get_lastlivevaluesjson: JSON direkt zurückgeben + if ($paramName === 'get_lastlivevaluesjson' && is_string($firstValue)) { + return $firstValue; + } + // Für JSON-Strings: direkt den String-Wert zurückgeben if (is_string($firstValue)) { return $firstValue;