Skip to content

Commit 7af7646

Browse files
committed
eavmlib: Remove json_encoder module
json_encoder was ancient code from 2018, that didn't even support maps, since AtomVM has support for json official API, it was time to remove it. Signed-off-by: Davide Bettio <davide@uninstall.it>
1 parent 5a720c3 commit 7af7646

5 files changed

Lines changed: 15 additions & 89 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ strict format validation
3434
- Fixed `erlang:binary_to_float/1` and `erlang:list_to_float/1` returning `inf` for overflow instead
3535
of raising `badarg`
3636

37+
### Removed
38+
- Removed old `json_encoder` module (now standard Erlang/OTP `json` module is available)
39+
3740
## [0.7.0-alpha.0] - 2026-03-20
3841

3942
### Added

UPDATING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ rather than copy sdkconfig.release-defaults.in to sdkconfig.defaults.in (which s
3030
`reconfigure` or `set-target` to be run to pick up the changes), this may also be combined with the
3131
`ATOMVM_ELIXIR_SUPPORT` option. For example, an Elixir-supported release build is configured using:
3232
`idf.py -DATOMVM_ELIXIR_SUPPORT=on -DATOMVM_RELEASE=on set-target ${CHIP}`
33+
- `json_encoder` module has been removed, use new (and standard) `json` module. New module uses
34+
standard Erlang/OTP API, that takes maps instead of proplists.
3335

3436
## v0.6.4 -> v0.6.5
3537

examples/erlang/system_info_server.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%
22
% This file is part of AtomVM.
33
%
4-
% Copyright 2019-2020 Davide Bettio <davide@uninstall.it>
4+
% Copyright 2019-2026 Davide Bettio <davide@uninstall.it>
55
%
66
% Licensed under the Apache License, Version 2.0 (the "License");
77
% you may not use this file except in compliance with the License.
@@ -62,18 +62,18 @@ handle_req("GET", [], Conn) ->
6262
Body = [<<"<html><body><h1>">>, TimeString, <<"</h1></body></html>">>],
6363
http_server:reply(200, Body, Conn);
6464
handle_req("GET", ["system", "info"], Conn) ->
65-
SysInfo = [
66-
{atom_count, erlang:system_info(atom_count)},
67-
{process_count, erlang:system_info(process_count)},
68-
{port_count, erlang:system_info(port_count)},
69-
{word_size, erlang:system_info(wordsize)},
70-
{system_architecture, erlang:system_info(system_architecture)}
71-
],
72-
Body = json_encoder:encode(SysInfo),
65+
SysInfo = #{
66+
atom_count => erlang:system_info(atom_count),
67+
process_count => erlang:system_info(process_count),
68+
port_count => erlang:system_info(port_count),
69+
word_size => erlang:system_info(wordsize),
70+
system_architecture => erlang:system_info(system_architecture)
71+
},
72+
Body = json:encode(SysInfo),
7373
http_server:reply(200, Body, Conn);
7474
handle_req("GET", ["processes", PidString, "info"], Conn) ->
7575
{Code, ProcInfo} = try_proc_info_list(PidString),
76-
Body = json_encoder:encode(ProcInfo),
76+
Body = json:encode(ProcInfo),
7777
http_server:reply(Code, Body, Conn);
7878
handle_req(Method, Path, Conn) ->
7979
io:format("Method: ~p Path: ~p~n", [Method, Path]),

libs/eavmlib/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ set(ERLANG_MODULES
2828
console
2929
gpio_hal
3030
i2c_hal
31-
json_encoder
3231
logger_manager
3332
port
3433
spi_hal

libs/eavmlib/src/json_encoder.erl

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)