1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 05:44:11 +02:00

Json array detection fix

This commit is contained in:
Brian Fiete 2021-09-10 14:09:22 -07:00
parent a0343678bc
commit 507fb82e4a

View file

@ -2357,16 +2357,32 @@ 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 (mayBeJsonArray)
{
if (c == '[')
continue; // Still ambiguous
if ((c == '{') || (c == '"'))
isJson = true;
break;
}
else
{
if (c == '{') if (c == '{')
isJson = true; isJson = true;
if (c == '[') if (c == '[')
isJson = true; {
mayBeJsonArray = true;
continue;
}
break; break;
} }
}
int32 aLineNum = 1; int32 aLineNum = 1;
int32 anIdx = 0; int32 anIdx = 0;