Class JsonFraming$
pekko.util.ByteString objects.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonFraming$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionobjectScanner(int maximumObjectLength) Returns a Flow that implements a "brace counting" based framing operator for emitting JSON objects.
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
JsonFraming$
public JsonFraming$()
-
-
Method Details
-
objectScanner
Returns a Flow that implements a "brace counting" based framing operator for emitting JSON objects.This operator only frames JSON objects; it is not a general-purpose JSON parser and does not validate the object contents. A top-level JSON array is supported only when all its elements are objects. Other top-level JSON values, such as strings, numbers, booleans, or
null, are not supported. JSON Lines or NDJSON input is supported when every record is an object. A leading UTF-8 byte-order mark (BOM) must be removed before framing.Typical examples of data that one may want to frame using this operator include:
**Very large arrays**:
[{"id": 1}, {"id": 2}, [...], {"id": 999}]**Multiple concatenated JSON objects** (with, or without commas between them):
{"id": 1}, {"id": 2}, [...], {"id": 999}The framing works independently of formatting, i.e. it will still emit JSON objects even if two elements are separated by multiple newlines or other whitespace characters. And of course is insensitive (and does not impact the emitting frame) to the JSON object's internal formatting.
For streaming nested JSON structures, see Apache Pekko Connectors JSON support.
- Parameters:
maximumObjectLength- The maximum length of allowed frames while decoding. If the maximum length is exceeded this Flow will fail the stream.
-