Json serialization typeclass #
This file provides helpers for serializing primitive types to json.
@[derive non_null_json_serializable] will make any structure json serializable; for instance,
@[derive non_null_json_serializable]
structure my_struct :=
(success : bool)
(verbose : ℕ := 0)
(extras : option string := none)
can parse {"success": true} as my_struct.mk true 0 none, and reserializing give
{"success": true, "verbose": 0, "extras": null}.
Main definitions #
json_serializable: a typeclass for objects which serialize to jsonjson_serializable.to_json x: convertxto jsonjson_serializable.of_json α j: readjin as anα