https://github.com/devinus/jsonex
JSON for Elixir
https://github.com/devinus/jsonex
Last synced: 7 months ago
JSON representation
JSON for Elixir
- Host: GitHub
- URL: https://github.com/devinus/jsonex
- Owner: devinus
- License: unlicense
- Created: 2013-02-26T20:57:21.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-16T15:38:14.000Z (over 12 years ago)
- Last Synced: 2025-02-03T23:45:08.058Z (over 1 year ago)
- Language: Elixir
- Homepage: https://github.com/devinus/jsonex
- Size: 160 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON for Elixir
[](https://travis-ci.org/devinus/jsonex)
## Encoding
```elixir
JSON.encode [ok: true] #=> "{\"ok\":true}"
```
## Decoding
```elixir
JSON.decode "{\"ok\":true}" #=> [{"ok",true}]
```
## Custom encoder/decoders
```elixir
defmodule MyJSON do
use JSON
def pre_encoder(:undefined), do: :null
def pre_encoder(value), do: super(value)
def post_decoder(null), do: :undefined
def post_decoder(value), do: super(value)
end
```