diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/json.gleam | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gleam/json.gleam b/src/gleam/json.gleam index c649ac3..8c3652c 100644 --- a/src/gleam/json.gleam +++ b/src/gleam/json.gleam @@ -98,6 +98,18 @@ pub external fn bool(input: Bool) -> Json = pub external fn int(input: Int) -> Json = "thoas_encode" "integer" +/// Encode an float into JSON. +/// +/// ## Examples +/// +/// ```gleam +/// > to_string(float(4.7)) +/// "4.7" +/// ``` +/// +pub external fn float(input: Float) -> Json = + "thoas_encode" "float" + /// The JSON value null. /// /// ## Examples |