Sha256: 8e0dcc5c9d0ec4cedae0e219119b961001a31bfa1aa69d154d6313e51f071546

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

-module(ejson).

-export([decode/1, encode/1]).

decode(Data) when is_list(Data) ->
    decode(list_to_binary(Data));
decode(Data) when is_binary(Data) ->
    case (catch ejson_decode:value(Data)) of
        {error, Reason} ->
            throw({invalid_json, Reason});
        {_Rest, EJson} ->
            EJson
    end.
    
encode(Term) ->
    case (catch ejson_encode:value(Term)) of
        {error, Reason} ->
            throw({invalid_erljson, Reason});
        Else ->
            Else
    end.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capricorn-2.0.11 erlang/lib/ejson/src/ejson.erl
capricorn-2.0.10 erlang/lib/ejson/src/ejson.erl
capricorn-2.0.9 erlang/lib/ejson/src/ejson.erl