Copyright (c) 2017-2019 Altenwald Solutions, S.L.
Authors: "Manuel Rubio" ([email protected]
).
This library implements the JSON functions as is in PHP code for ephp keeping in mind to have it as pure 100% Erlang.
ePHP JSON requires to be run over an Erlang/OTP 17+, but not all the versions are full compatible or recommended. See the list:
Erlang Version | Support | Notes |
---|---|---|
22.1 | ✔️ | Recommended if you use OTP 22 |
22.0 | ✔️ | |
21.3 | ✔️ | Recommended if you use OTP 21 |
21.2 | ✔️ | |
21.1 | ✔️ | |
21.0 | ✔️ | |
20.3 | ❌ | Fails in math and number conversion |
20.2 | ✔️ | Recommended if you use OTP 20 |
20.1 | ✔️ | |
20.0 | ✔️ | |
19.3 | ✔️ | Recommended if you use OTP 19 |
19.2 | ✔️ | |
19.1 | ✔️ | |
19.0 | ✔️ | |
18.3 | ✔️ | Recommended if you use OTP 18 |
18.2.1 | ✔️ | |
18.2 | ✔️ | |
18.1 | ✔️ | |
18.0 | ✔️ |
A simple way to use, is include in your project rebar.config
the following dependency line:
{ephp_json, ".*", {git, "git://github.com/bragful/ephp_json.git", master}}
And use the following code in your project:
{ok, Ctx} = ephp:context_new(),
ephp:register_module(Ctx, ephp_lib_json),
PHP = "Empty array output as array: <?=json_encode('tada')?>",
{ok, Text} = ephp:eval(Ctx, PHP).
The result stored in Text
should be:
Empty array output as array: "tada"
Enjoy!
ephp_lib_json |