Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
Paul J. Davis a2a7bc91af API Change - No more {ok, Value} wrapping. 14 роки тому
c_src API Change - No more {ok, Value} wrapping. 14 роки тому
src API Change - No more {ok, Value} wrapping. 14 роки тому
test API Change - No more {ok, Value} wrapping. 14 роки тому
.gitignore Initial import. 14 роки тому
LICENSE Mark source code with MIT license info. 14 роки тому
Makefile Initial import. 14 роки тому
README.md More OCD on padding issue. 14 роки тому
rebar Initial import. 14 роки тому
rebar.config Initial import. 14 роки тому

README.md

Jiffy - JSON NIFs for Erlang

A JSON parser as a NIF. This is a complete rewrite of the work I did in EEP0018 that was based on Yajl. This new version is a hand crafted state machine that does its best to be as quick and efficient as possible while not placing any constraints on the parsed JSON.

Usage

Jiffy's API is nearly an exact duplicate of the EEP0018 behaviour except for one small difference. jiffy:encode/1 now returns an iolist (specifically, a binary or list of binaries). This is to allow for the encoding of large numbers.

Eshell V5.8.2  (abort with ^G)
1> jiffy:decode(<<"{\"foo\": \"bar\"}">>).
{ok,{[{<<"foo">>,<<"bar">>}]}}
2> Doc = {[{foo, [<<"bing">>, 2.3, true]}]}.
{[{foo,[<<"bing">>,2.3,true]}]}
3> jiffy:encode(Doc).
{ok,<<"{\"foo\":[\"bing\",2.2999999999999998224,true]}">>}

Data Format

Erlang                          JSON            Erlang
==========================================================================

null                       -> null           -> null
true                       -> true           -> true
false                      -> false          -> false
"hi"                       -> [104, 105]     -> [104, 105]
<<"hi">>                   -> "hi"           -> <<"hi">>
hi                         -> "hi"           -> <<"hi">>
1                          -> 1              -> 1
1.25                       -> 1.25           -> 1.24
[]                         -> []             -> []
[true, 1.0]                -> [true, 1.0]    -> [true, 1.0]
{[]}                       -> {}             -> {[]}
{[{foo, bar}]}             -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}
{[{<<"foo">>, <<"bar">>}]} -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}

Improvements over EEP0018

Jiffy should be in all ways an improvemnt over EEP0018. It no longer imposes limits on the nesting depth. It is capable of encoding and decoding large numbers and t does quite a bit more checking for validity of valid UTF-8 in strings.