mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-19 05:47:57 +01:00
Merge remote-tracking branch 'pr19/master'
This commit is contained in:
commit
c3aa1f7c62
@ -109,6 +109,7 @@ class Parser implements \IteratorAggregate
|
||||
}
|
||||
if ($currentLevel < $iteratorLevel && $inArray && $expectedType & self::ANY_VALUE) {
|
||||
$currentPath[$currentLevel] = isset($currentPath[$currentLevel]) ? (string)(1+(int)$currentPath[$currentLevel]) : "0";
|
||||
unset($currentPath[$currentLevel+1]);
|
||||
}
|
||||
switch ($firstChar) {
|
||||
case '"':
|
||||
@ -120,6 +121,7 @@ class Parser implements \IteratorAggregate
|
||||
$jsonBuffer = '';
|
||||
} elseif ($currentLevel < $iteratorLevel) {
|
||||
$currentPath[$currentLevel] = json_decode($this->token);
|
||||
unset($currentPath[$currentLevel+1]);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
19
test/JsonMachineTest/PR-19-FIX.json
Normal file
19
test/JsonMachineTest/PR-19-FIX.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"datafeed": {
|
||||
"info": {
|
||||
"category": "Category name"
|
||||
},
|
||||
"programs": [
|
||||
{
|
||||
"program_info": {
|
||||
"id": "X0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"program_info": {
|
||||
"id": "X1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -51,6 +51,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
||||
['/path/after-vectors', '{"path":{"array":[],"object":{},"after-vectors":{"c":1,"d":2}}}', ['c'=>1,'d'=>2]],
|
||||
['/0/0', '[{"0":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]],
|
||||
['/1/1', '[0,{"1":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]],
|
||||
'PR-19-FIX' => ['/datafeed/programs/1', file_get_contents(__DIR__.'/PR-19-FIX.json'), ['program_info'=>['id'=>'X1']]],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user