Package dev.frostlake.functions.scalar
Class JsonArrayHoles
java.lang.Object
dev.frostlake.functions.scalar.JsonArrayHoles
Array HOLES — the elisions a JSON array may be written with, which Snowflake reads as
undefined
elements instead of refusing the document.
Live-verified. A comma with no element before it opens a hole, and the bracket that closes an array closes one too — but only where the array holds a real element, so an array written entirely of commas holds one element per comma rather than one more:
[1,,2] -> [1,undefined,2] [1,,,2] -> [1,undefined,undefined,2] [,1] -> [undefined,1] [1,2,] -> [1,2,undefined] (THREE elements, not two) [,] -> [undefined] [] -> [] [[1,,2],3] -> [[1,undefined,2],3]
The trailing comma is the cell to keep in view: it is not a refusal becoming an answer but a stored array growing an element, because a lenient reader would otherwise drop it.
An OBJECT has no holes — {"a":,"b":1} and {,"a":1} are refused as a misplaced
comma — so only array levels are filled, and a trailing comma in an object stays the reader's own to
forgive.
Holes are written out as the bare undefined token, which leaves their placement rules to
VariantUndefined.
-
Method Summary
-
Method Details
-
fill
The document with every array hole written out as anundefinedtoken. Text holding no hole is returned unchanged, and a document that is not JSON at all is left for the reader to refuse.
-