diff --git a/src/Core/Value.php b/src/Core/Value.php index 117c01c..2bb8b0b 100644 --- a/src/Core/Value.php +++ b/src/Core/Value.php @@ -47,7 +47,7 @@ public function decode($values): mixed } //$value = (string) $value; if ($this->isNumeric()) { - return $this; + return $this->value; } else if ($this->isString()) { $prefix = $this->getStringPrefix(); diff --git a/tests/CompressJsonBaseTest.php b/tests/CompressJsonBaseTest.php index acd1c49..9cce0d7 100644 --- a/tests/CompressJsonBaseTest.php +++ b/tests/CompressJsonBaseTest.php @@ -130,4 +130,17 @@ public function testSecondValueAsNumericalString() // Assert $this->assertEquals($data, $decompressed); } + + public function testNumericalStringDecompressJson() + { + //raw json + $rawJson = '["0"]'; + //compress-json.js generated compressed json + $compressedJson = '[["0","a|0"],"1"]'; + $data=json_decode($rawJson,true); + $decompressed = Compressor::create() + ->decompressJson($compressedJson); + // Assert + $this->assertSame($data, $decompressed); + } } \ No newline at end of file