https://github.com/violetbuse/jackson
Pure gleam json decode/encode and json pointer resolution
https://github.com/violetbuse/jackson
Last synced: 4 months ago
JSON representation
Pure gleam json decode/encode and json pointer resolution
- Host: GitHub
- URL: https://github.com/violetbuse/jackson
- Owner: violetbuse
- Created: 2024-06-07T18:42:23.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-11T21:39:28.000Z (about 2 years ago)
- Last Synced: 2025-10-02T04:59:35.939Z (8 months ago)
- Language: Gleam
- Homepage: https://hexdocs.pm/jackson
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jackson
[](https://hex.pm/packages/jackson)
[](https://hexdocs.pm/jackson/)
```sh
gleam add jackson
```
## Decoding a json value
```gleam
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
```gleam
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 .
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```