* Decode JSON input, supporting both standard and line-delimited JSON. */
(string $rawResult)
| 185 | * Decode JSON input, supporting both standard and line-delimited JSON. |
| 186 | */ |
| 187 | private function decodeJsonInput(string $rawResult) { |
| 188 | $json = json_decode($rawResult, true); |
| 189 | if ($json === null && trim($rawResult) !== '') { |
| 190 | $json = []; |
| 191 | foreach (explode("\n", trim($rawResult)) as $line) { |
| 192 | $decoded = json_decode($line, true); |
| 193 | if ($decoded !== null) { |
| 194 | $json[] = $decoded; |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | return $json; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Extracts fields inside curly braces from the path string. |