utilities

Functions

pub fn create_json_object(key: String, value: String) -> String

Create a simple JSON object with a single key-value pair

pub fn create_json_object_from_pairs(
  pairs: List(#(String, String)),
) -> String

Create a JSON object from multiple key-value pairs

pub fn encode_bool(value: Bool) -> String

Encode a boolean value into a JSON string

pub fn encode_float(value: Float) -> String

Encode a float (floating point) value into a JSON string

pub fn encode_int(value: Int) -> String

Encode an int (interger) value into a JSON string

pub fn encode_list(values: List(String)) -> String

Encode a list of values into a JSON array string

pub fn encode_object(values: Dict(String, String)) -> String

Encode a map of string keys and string values into a JSON object string

pub fn encode_string(value: String) -> String

Encode a string value into a JSON string

pub fn parse_json_bool(
  json: String,
  field: String,
) -> Result(Bool, String)

Parse a JSON string and return the boolean value of a given field.

Search Document