ExactJson

object ExactJson

JSON compared as a backend may give it back: objects by field whatever their key order (PostgreSQL JSONB reorders keys), numbers by exact value and scale, so 2.50 is not 2.5 and an integer is not a decimal.

Properties

Link copied to clipboard
const val NUMBERS: String

A JSON object whose numbers a backend must keep exactly: a decimal's trailing zeros, a 30-digit decimal, an integer beyond long, one beyond a double's precision, and decimals in a nested untyped map.

Functions

Link copied to clipboard
fun of(text: String): Any?

A value of text that equals another's exactly when both hold the same JSON, numbers as written.

Link copied to clipboard
fun valueOf(text: String): Any?

A value of text that equals another's when both hold the same JSON whatever form their numbers are written in: 1.0E10 is 10000000000 and 2.50 is 2.5, as the kernel compares a snapshot's state with what it writes back. A backend may give a number back in another form (PostgreSQL JSONB writes no exponent) but with its value.