Returns a converter for JSON-compatible objects or values, with errors for known-incompatible types.

Based on json, but additionally runs a check during every encode call, throwing an error if the object contains fields which cannot be round-tripped to JSON (Date, Map). This incurs some cost in checking each instance, but gives clear errors rather than late serdes mismatches.

Example:

interface Data {
m: Map<string, string>
}
const d: Data = { m: new Map<string, string>() };
d.m.set("hello", "John");

const conv = ccfapp.json<Data>();
const buffer = conv.encode(d); // ArrayBuffer, but contents of map silently lost!
const d2 = conv.decode(buffer); // Data, but doesn't match d!

const convChecked = ccfapp.checkedJson<Data>();
const buffer2 = convChecked.encode(d); // Throws TypeError