Package dev.turboism.protocol.json
Class StrictJson
java.lang.Object
dev.turboism.protocol.json.StrictJson
Dependency-free strict JSON codec shared by bounded local protocol transports.
The parser rejects malformed UTF-8, byte-order marks, duplicate object keys, unpaired surrogates, invalid numbers, trailing content, and nesting deeper than 64 levels. The writer accepts only JSON-native Java value shapes and rejects non-finite numbers.
-
Method Summary
-
Method Details
-
parse
public static <T> T parse(byte[] bytes) Parses one complete UTF-8 JSON document.- Parameters:
bytes- complete document bytes- Returns:
- maps, lists, strings, booleans, numbers, or
null - Throws:
IllegalArgumentException- when the document is not strict JSON
-
bytes
public static <T> byte[] bytes(T value) - Returns:
- the strict UTF-8 JSON encoding of
value
-
stringify
- Returns:
- the strict JSON text encoding of
value
-