Skip to content

Pure gleam json decode/encode and json pointer resolution

Notifications You must be signed in to change notification settings

VioletBuse/jackson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jackson

Package Version Hex Docs

gleam add jackson

Decoding a json value

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))
  )
}

Encoding a json value

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.

Development

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell

About

Pure gleam json decode/encode and json pointer resolution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages