An incredibly flexible and performant JSON parser, generator and formatter for Elixir.
Exneus is a wrapper for Elixir of Euneus, an Erlang library built on the top of the new OTP json module.
Both encoder and decoder fully conform to RFC 8259 and ECMA 404 standards and are tested using JSONTestSuite.
Further explanation and examples are available at hexdocs.
def deps do
[
{:json_polyfill, "~> 0.1"}, # Required only for OTP < 27
{:exneus, "~> 0.1"}
]
end
iex(1)> Exneus.encode!(%{name: "Joe Armstrong", age: 68, nationality: "British"})
"{\"name\":\"Joe Armstrong\",\"age\":68,\"nationality\":\"British\"}"
iex(2)> Exneus.decode!(v(1))
%{"age" => 68, "name" => "Joe Armstrong", "nationality" => "British"}
Functions that provide JSON encoding:
Exneus.encode!/2
Exneus.encode_to_iodata!/2
Functions that provide JSON decoding:
Exneus.decode!/2
Functions that provide JSON decode streaming:
Exneus.decode_stream_start!/2
Exneus.decode_stream_continue!/2
Exneus.decode_stream_end!/1
Functions that provide JSON formatting:
Exneus.minify/1
Exneus.minify_to_iodata/1
Exneus.format/2
Exneus.format_to_iodata/2
See BENCHMARK.md for more information.
##### With input Blockchain #####
Name ips
euneus 36.95 K
json (OTP) 35.85 K - 1.03x slower +0.83 μs
Exneus 35.71 K - 1.03x slower +0.94 μs
jiffy 34.70 K - 1.06x slower +1.76 μs
Jason 26.75 K - 1.38x slower +10.32 μs
thoas 16.40 K - 2.25x slower +33.92 μs
jsone 15.52 K - 2.38x slower +37.38 μs
jsx 4.21 K - 8.77x slower +210.29 μs
JSON 3.88 K - 9.52x slower +230.47 μs
Memory usage statistics:
Name average
euneus 84.20 KB
json (OTP) 82.66 KB - 0.98x memory usage -1.53125 KB
Exneus 84.13 KB - 1.00x memory usage -0.06250 KB
jiffy 7.79 KB - 0.09x memory usage -76.40625 KB
Jason 78.32 KB - 0.93x memory usage -5.87500 KB
thoas 89.41 KB - 1.06x memory usage +5.22 KB
jsone 178.56 KB - 2.12x memory usage +94.37 KB
jsx 397.30 KB - 4.72x memory usage +313.11 KB
JSON 481.30 KB - 5.72x memory usage +397.11 KB
##### With input Blockchain #####
Name ips
json (OTP) 18.79 K
euneus 18.06 K - 1.04x slower +2.16 μs
Exneus 17.68 K - 1.06x slower +3.34 μs
Jason 15.16 K - 1.24x slower +12.74 μs
jsone 13.82 K - 1.36x slower +19.17 μs
jiffy 12.76 K - 1.47x slower +25.15 μs
thoas 11.89 K - 1.58x slower +30.89 μs
jsx 4.93 K - 3.81x slower +149.64 μs
JSON 2.43 K - 7.74x slower +358.48 μs
Memory usage statistics:
Name average
json (OTP) 35.95 KB
euneus 36.93 KB - 1.03x memory usage +0.98 KB
Exneus 37.05 KB - 1.03x memory usage +1.09 KB
Jason 51.63 KB - 1.44x memory usage +15.67 KB
jsone 131.70 KB - 3.66x memory usage +95.74 KB
jiffy 1.55 KB - 0.04x memory usage -34.40625 KB
thoas 51.41 KB - 1.43x memory usage +15.46 KB
jsx 315.84 KB - 8.78x memory usage +279.89 KB
JSON 1042.65 KB - 29.00x memory usage +1006.69 KB
If you like this tool, please consider sponsoring me. I'm thankful for your never-ending support ❤️
I also accept coffees ☕
Copyright (c) 2024 William Fank Thomé
Exneus is 100% open-source and community-driven. All components are available under the Apache 2 License on GitHub.
See LICENSE.md for more information.