Erlangで実装されたJSONのエンコード/デコードライブラリ。
ビルドツールにはrebarを使用している。
ビルド手順:
# ビルド
$ git clone git://github.com/sile/jsone.git
$ make init
# テスト & dialyzer 実行
$ make
# ロードパスに追加してErlangシェルを起動
$ make start
1> jsone:decode(<<"[1,2,3]">>).
[1,2,3]
%% デコード
> jsone:decode(<<"[1,2,3]">>).
[1,2,3]
> json:decode(<<"{\"1\":2}">>).
{[{<<"1">>,2}]} % オブジェクトは {[Key, Value]} 形式にデコードされる
%% エンコード
> jsone:encode([1,2,3]).
<<"[1,2,3]">>
Erlang | JSON | |
---|---|---|
number | 123 | 123 |
null | null | null |
boolean | true | true |
string | <<"abc">> | "abc" |
array | [1,2,3] | [1,2,3] |
object | {[{<<"key">>, <<"value">>}]} | {"key":"value"} |