mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Json array detection fix
This commit is contained in:
parent
a0343678bc
commit
507fb82e4a
1 changed files with 21 additions and 5 deletions
|
@ -2357,15 +2357,31 @@ namespace Beefy.utils
|
|||
mNextKeys.Reserve(guessItems);
|
||||
|
||||
bool isJson = false;
|
||||
bool mayBeJsonArray = false;
|
||||
for (char8 c in mSource.RawChars)
|
||||
{
|
||||
if (c.IsWhiteSpace)
|
||||
continue;
|
||||
if (c == '{')
|
||||
isJson = true;
|
||||
if (c == '[')
|
||||
isJson = true;
|
||||
break;
|
||||
|
||||
if (mayBeJsonArray)
|
||||
{
|
||||
if (c == '[')
|
||||
continue; // Still ambiguous
|
||||
if ((c == '{') || (c == '"'))
|
||||
isJson = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c == '{')
|
||||
isJson = true;
|
||||
if (c == '[')
|
||||
{
|
||||
mayBeJsonArray = true;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int32 aLineNum = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue