diff --git a/src/Formats/data/json/init.luau b/src/Formats/data/json/init.luau index 6b3e2fd..bf75d5f 100644 --- a/src/Formats/data/json/init.luau +++ b/src/Formats/data/json/init.luau @@ -36,7 +36,12 @@ function JsonFormat.sniff(r: Bytes.Reader): number local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 elseif first == "[" then - return 0.3 + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 end return 0 end