toJsonSummaryString

fun toJsonSummaryString(limit: Int = DEFAULT_SUMMARY_LIMIT): String

Where it is and roughly what it holds: $['items'][0] {"sku":"a",…3 more}.

The location in VariantPath.toNormalizedPath's form — the spelling another reader can parse — followed by a space and Variant.toJsonSummaryString's outline of the value.

The cost contract is that file's, with the one honest addition: the result's length and the bytes read are bounded by a function of limit, SUMMARY_VALUE_LIMIT and the length of location. A path is not bounded by anything, so claiming otherwise would be claiming a bound this cannot hold. What it does hold is the half that matters: the value costs the same whether it is a boolean or four megabytes.

Parameters

limit

top-level children of value to show.

Throws

if limit is negative, or if location holds a field name with an unpaired surrogate — see VariantPath.toNormalizedPath.

if the value's bytes do not decode. A summary reports unreadable data rather than eliding it; toString is the form that cannot throw.


fun toJsonSummaryString(limit: Int = DEFAULT_SUMMARY_LIMIT, depth: Int): String

The same, expanding depth levels of value rather than one: $['items'][0] {"meta":{"lot":7,…2 more},"sku":"a"}.

A node's summary is a value's summary with a location in front of it, and that stays true of every depth — this exists so the pairing does not quietly become the one thing you have to unwrap before you can look properly. Everything the Variant overload says about the cost of a depth applies unchanged, and the location's own contribution is unbounded here for the reason given above.

Parameters

limit

children of value to show at each level.

depth

levels of value to expand; 1 is the outline above.

Throws

if limit is negative, if depth is out of range, or if location holds a field name with an unpaired surrogate.