diff options
| author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-08-21 17:49:07 +0100 |
|---|---|---|
| committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-08-21 17:49:07 +0100 |
| commit | d433235b25c9a2dfb8e56aea7d66e5ef181ceca5 (patch) | |
| tree | fc8613c72737b6dd977d870b9a1f66620f4e84bc /src | |
| parent | 8da7e50e891052179304a71c17ef3e599f7beabe (diff) | |
| download | rabbitmq-server-git-d433235b25c9a2dfb8e56aea7d66e5ef181ceca5.tar.gz | |
remove the wrapper functions around mochijson2
In the end it's better to keep the `struct' tag - empty lists are ambiguous.
I was mislead by the fact that the management plugin removes the outer
`struct'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_misc.erl | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 55048d59d2..8f6a9bcf4e 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -60,7 +60,6 @@ -export([multi_call/2]). -export([os_cmd/1]). -export([gb_sets_difference/2]). --export([json_decode/1, json_encode/1]). %% Horrible macro to use in guards -define(IS_BENIGN_EXIT(R), @@ -935,23 +934,3 @@ os_cmd(Command) -> gb_sets_difference(S1, S2) -> gb_sets:fold(fun gb_sets:delete_any/2, S1, S2). - -json_to_term({struct, Obj}) -> - lists:map(fun ({K, V}) -> {K, json_to_term(V)} end, Obj); -json_to_term(Array) when is_list(Array) -> - lists:map(fun json_to_term/1, Array); -json_to_term(Value) -> - Value. - -json_decode(Body) -> - json_to_term(mochijson2:decode(Body)). - -term_to_json([{_, _}|_] = Obj) -> - {struct, lists:map(fun ({K, V}) -> {K, term_to_json(V)} end, Obj)}; -term_to_json(Array) when is_list(Array) -> - lists:map(fun term_to_json/1, Array); -term_to_json(Value) -> - Value. - -json_encode(Term) -> - mochijson2:encode(term_to_json(Term)). |
