View Source euneus (euneus v1.2.1)

Core module.

Copyright 2023 William Fank Thomé

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Summary

Functions

Equivalent to euneus_decoder_smart:decode / 1.

Equivalent to euneus_decoder:decode / 2.

Equivalent to euneus_decoder:decode_parsed / 2.

Equivalent to euneus_encoder_smart_json:encode / 1.

Equivalent to euneus_encoder:encode / 2.

Equivalent to euneus_encoder_smart_html:encode / 1.

Generates a JSON as erlang:binary() from Erlang term.

Equivalent to euneus_encoder_smart_javascript:encode / 1.

Generates a JSON as erlang:binary() from Erlang term.

Equivalent to euneus_encoder:encode_parsed / 2.

Generates a JSON as erlang:binary() from Erlang term.

Generates a JSON as erlang:binary() from Erlang term.

See also: euneus_encoder:encode/2.

Equivalent to euneus_encoder_smart_unicode:encode / 1.

Generates a JSON as erlang:binary() from Erlang term.

Equivalent to euneus_formatter:format / 2.

Equivalent to euneus_formatter:format_parsed / 2.

Equivalent to euneus_formatter:minify / 1.

Remove extra spaces and line feeds from JSON.

See also: euneus_formatter:minify/1.

Equivalent to euneus_decoder:parse_opts / 1.

Equivalent to euneus_encoder:parse_opts / 1.

Equivalent to euneus_formatter:parse_opts / 1.

Equivalent to euneus_formatter:prettify / 1.

Format JSON for printing.

See also: euneus_formatter:prettify/1.

Types

-type decode_input() :: euneus_decoder:input().
-type decode_opts() :: euneus_decoder:options().
-type decode_parsed_opts() :: euneus_decoder:parsed_options().
-type decode_result() :: euneus_decoder:result().
-type encode_input() :: euneus_encoder:input().
-type encode_opts() :: euneus_encoder:options().
-type encode_parsed_opts() :: euneus_encoder:parsed_options().
-type encode_result() :: euneus_encoder:result().
Link to this type

encode_to_bin_result/0

View Source
-type encode_to_bin_result() :: {ok, binary()} | {error, euneus_encoder:error_reason()}.
-type format_input() :: euneus_formatter:input().
-type format_opts() :: euneus_formatter:options().
-type format_parsed_opts() :: euneus_formatter:parsed_options().
-type format_result() :: euneus_formatter:result().

Functions

-spec decode(Input) -> Result when Input :: decode_input(), Result :: decode_result().

Equivalent to euneus_decoder_smart:decode / 1.

Parses JSON to Erlang term.

See also: euneus_decoder_smart:decode/1.

-spec decode(Input, Opts) -> Result
          when Input :: decode_input(), Opts :: decode_opts(), Result :: decode_result().

Equivalent to euneus_decoder:decode / 2.

Parses JSON to Erlang term.

See also: euneus_decoder:decode/2.

Link to this function

decode_parsed(Input, ParsedOpts)

View Source
-spec decode_parsed(Input, ParsedOpts) -> Result
                 when
                     Input :: decode_input(),
                     ParsedOpts :: decode_parsed_opts(),
                     Result :: decode_result().

Equivalent to euneus_decoder:decode_parsed / 2.

Parses JSON to Erlang term.

See also: euneus_decoder:decode_parsed/2.

-spec encode(Input) -> Return when Input :: encode_input(), Return :: encode_result().

Equivalent to euneus_encoder_smart_json:encode / 1.

Generates a JSON from Erlang term.

Uses JSON encoder.

See also: euneus_encoder_smart_json:encode/1.

-spec encode(Input, Opts) -> Return
          when Input :: encode_input(), Opts :: encode_opts(), Return :: encode_result().

Equivalent to euneus_encoder:encode / 2.

Generates a JSON from Erlang term.

See also: euneus_encoder:encode/2.

-spec encode_html(Input) -> Return when Input :: encode_input(), Return :: encode_result().

Equivalent to euneus_encoder_smart_html:encode / 1.

Generates a JSON from Erlang term.

Uses HTML encoder.

See also: euneus_encoder_smart_html:encode/1.

Link to this function

encode_html_to_binary(Input)

View Source
-spec encode_html_to_binary(Input) -> Return
                         when Input :: encode_input(), Return :: encode_to_bin_result().

Generates a JSON as erlang:binary() from Erlang term.

Uses HTML encoder.

See also: euneus_encoder_smart_html:encode/1.

-spec encode_js(Input) -> Return when Input :: encode_input(), Return :: encode_result().

Equivalent to euneus_encoder_smart_javascript:encode / 1.

Generates a JSON from Erlang term.

Uses Javascript encoder.

See also: euneus_encoder_smart_javascript:encode/1.

Link to this function

encode_js_to_binary(Input)

View Source
-spec encode_js_to_binary(Input) -> Return
                       when Input :: encode_input(), Return :: encode_to_bin_result().

Generates a JSON as erlang:binary() from Erlang term.

Uses Javascript encoder.

See also: euneus_encoder_smart_javascript:encode/1.

Link to this function

encode_parsed(Input, ParsedOpts)

View Source
-spec encode_parsed(Input, ParsedOpts) -> Result
                 when
                     Input :: encode_input(),
                     ParsedOpts :: encode_parsed_opts(),
                     Result :: encode_result().

Equivalent to euneus_encoder:encode_parsed / 2.

Generates a JSON from Erlang term.

See also: euneus_encoder:encode_parsed/2.

Link to this function

encode_parsed_to_binary(Input, ParsedOpts)

View Source
-spec encode_parsed_to_binary(Input, ParsedOpts) -> Result
                           when
                               Input :: encode_input(),
                               ParsedOpts :: encode_parsed_opts(),
                               Result :: encode_to_bin_result().
Generates a JSON as erlang:binary() from Erlang term.

See also: euneus_encoder:encode_parsed/2.

-spec encode_to_binary(Input) -> Return when Input :: encode_input(), Return :: encode_to_bin_result().

Generates a JSON as erlang:binary() from Erlang term.

Uses JSON encoder.

See also: euneus_encoder_smart_json:encode/1.

Link to this function

encode_to_binary(Input, Opts)

View Source
-spec encode_to_binary(Input, Opts) -> Return
                    when
                        Input :: encode_input(),
                        Opts :: encode_opts(),
                        Return :: encode_to_bin_result().
Generates a JSON as erlang:binary() from Erlang term.

See also: euneus_encoder:encode/2.

-spec encode_unicode(Input) -> Return when Input :: encode_input(), Return :: encode_result().

Equivalent to euneus_encoder_smart_unicode:encode / 1.

Generates a JSON from Erlang term.

Uses Unicode encoder.

See also: euneus_encoder_smart_unicode:encode/1.

Link to this function

encode_unicode_to_binary(Input)

View Source
-spec encode_unicode_to_binary(Input) -> Return
                            when Input :: encode_input(), Return :: encode_to_bin_result().

Generates a JSON as erlang:binary() from Erlang term.

Uses Unicode encoder.

See also: euneus_encoder_smart_unicode:encode/1.

-spec format(Input, Opts) -> Result
          when Input :: format_input(), Opts :: format_opts(), Result :: format_result().

Equivalent to euneus_formatter:format / 2.

Format JSON.

See also: euneus_formatter:format/2.

Link to this function

format_parsed(Input, Opts)

View Source
-spec format_parsed(Input, Opts) -> Result
                 when
                     Input :: format_input(),
                     Opts :: format_parsed_opts(),
                     Result :: format_result().

Equivalent to euneus_formatter:format_parsed / 2.

Format JSON.

See also: euneus_formatter:format_parsed/2.

Link to this function

format_parsed_to_binary(Input, Opts)

View Source
-spec format_parsed_to_binary(Input, Opts) -> Result
                           when
                               Input :: format_input(),
                               Opts :: format_parsed_opts(),
                               Result :: binary().
Format JSON.

See also: euneus_formatter:format_parsed/2.

Link to this function

format_to_binary(Input, Opts)

View Source
-spec format_to_binary(Input, Opts) -> Result
                    when Input :: format_input(), Opts :: format_opts(), Result :: binary().
Format JSON.

See also: euneus_formatter:format/2.

-spec minify(Input) -> Result when Input :: format_input(), Result :: format_result().

Equivalent to euneus_formatter:minify / 1.

Remove extra spaces and line feeds from JSON.

See also: euneus_formatter:minify/1.

-spec minify_to_binary(Input) -> Result when Input :: format_input(), Result :: binary().
Remove extra spaces and line feeds from JSON.

See also: euneus_formatter:minify/1.

-spec parse_decode_opts(Opts) -> Result when Opts :: decode_opts(), Result :: decode_parsed_opts().

Equivalent to euneus_decoder:parse_opts / 1.

Parses euneus_decoder:options() to euneus_decoder:parsed_options().

See also: euneus_decoder:decode_parsed/2, euneus_decoder:parse_opts/1.

-spec parse_encode_opts(Opts) -> Result when Opts :: encode_opts(), Result :: encode_parsed_opts().

Equivalent to euneus_encoder:parse_opts / 1.

Parses euneus_encoder:options() to euneus_encoder:parsed_options().

See also: euneus_encoder:encode_parsed/2, euneus_encoder:parse_opts/1.

-spec parse_format_opts(Opts) -> Result when Opts :: format_opts(), Result :: format_parsed_opts().

Equivalent to euneus_formatter:parse_opts / 1.

Parses euneus_formatter:options() to euneus_formatter:parsed_options().

See also: euneus_formatter:format_parsed/2, euneus_formatter:parse_opts/1.

-spec prettify(Input) -> Result when Input :: format_input(), Result :: format_result().

Equivalent to euneus_formatter:prettify / 1.

Format JSON for printing.

See also: euneus_formatter:prettify/1.

Link to this function

prettify_to_binary(Input)

View Source
-spec prettify_to_binary(Input) -> Result when Input :: format_input(), Result :: binary().
Format JSON for printing.

See also: euneus_formatter:prettify/1.