mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 05:14:10 +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);
|
mNextKeys.Reserve(guessItems);
|
||||||
|
|
||||||
bool isJson = false;
|
bool isJson = false;
|
||||||
|
bool mayBeJsonArray = false;
|
||||||
for (char8 c in mSource.RawChars)
|
for (char8 c in mSource.RawChars)
|
||||||
{
|
{
|
||||||
if (c.IsWhiteSpace)
|
if (c.IsWhiteSpace)
|
||||||
continue;
|
continue;
|
||||||
if (c == '{')
|
|
||||||
isJson = true;
|
if (mayBeJsonArray)
|
||||||
if (c == '[')
|
{
|
||||||
isJson = true;
|
if (c == '[')
|
||||||
break;
|
continue; // Still ambiguous
|
||||||
|
if ((c == '{') || (c == '"'))
|
||||||
|
isJson = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (c == '{')
|
||||||
|
isJson = true;
|
||||||
|
if (c == '[')
|
||||||
|
{
|
||||||
|
mayBeJsonArray = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 aLineNum = 1;
|
int32 aLineNum = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue