gleam add jackson
import jackson
import gleam/result
import gleam/dynamic
pub fn main() {
fetch_value()
|> jackson.parse
|> result.map(
jackson.decode(dynamic.decode2(Constructor, field("id", dynamic.int), field("name", dynamic.string))
)
}
import jackson
jackson.object(
#("id", jackson.int(2)),
#("name", jackson.string("michael"))
)
|> jackson.to_string()
// {"id": 2, "name": "michael"}
Further documentation can be found at https://hexdocs.pm/jackson.
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell