public static parse<TYPE>(json as String) as TYPE:
Parses JSON text using the explicitly requested static type.
Natural JSON representations are returned directly when compatible with TYPE. Structured value types such as Rational are materialized only when that exact target type is requested; ordinary maps are never reinterpreted merely because they contain similarly named keys.
| Parameter | Description |
|---|---|
json | JSON document to parse. |
Parsed value represented as TYPE.
ratio = JSON.parse<Rational>("""{"numerator": 1, "denominator": 3}""")
assert ratio == Rational(1, 3)