aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_json_ffi.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gleam_json_ffi.erl')
-rw-r--r--src/gleam_json_ffi.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gleam_json_ffi.erl b/src/gleam_json_ffi.erl
index 94c3cc5..c33f87f 100644
--- a/src/gleam_json_ffi.erl
+++ b/src/gleam_json_ffi.erl
@@ -1,6 +1,12 @@
-module(gleam_json_ffi).
--export([json_to_iodata/1, json_to_string/1]).
+-export([
+ decode/1, json_to_iodata/1, json_to_string/1, int/1, float/1, string/1,
+ bool/1, null/0, array/1, object/1
+]).
+
+decode(Json) ->
+ thoas:decode(Json).
json_to_iodata(Json) ->
Json.
@@ -9,3 +15,11 @@ json_to_string(Json) when is_binary(Json) ->
Json;
json_to_string(Json) when is_list(Json) ->
list_to_binary(Json).
+
+null() -> thoas_encode:null().
+int(X) -> thoas_encode:integer(X).
+bool(X) -> thoas_encode:boolean(X).
+float(X) -> thoas_encode:float(X).
+string(X) -> thoas_encode:string(X).
+object(X) -> thoas_encode:non_recursive_object(X).
+array(X) -> thoas_encode:non_recursive_array(X).