Просмотр исходного кода

Fix minor typos on jsone.erl; regenerate jsone.md

Marcelino Alberdi Pereira 4 лет назад
Родитель
Сommit
3a91c1ebc1
2 измененных файлов с 17 добавлено и 4 удалено
  1. 15 2
      doc/jsone.md
  2. 2 2
      src/jsone.erl

+ 15 - 2
doc/jsone.md

@@ -72,7 +72,7 @@ datetime_format() = iso8601
 
 
 <pre><code>
-decode_option() = {object_format, tuple | proplist | map} | {allow_ctrl_chars, boolean()} | reject_invalid_utf8 | {keys, binary | atom | existing_atom | attempt_atom} | <a href="#type-common_option">common_option()</a>
+decode_option() = {object_format, tuple | proplist | map} | {allow_ctrl_chars, boolean()} | reject_invalid_utf8 | {keys, binary | atom | existing_atom | attempt_atom} | {duplicate_map_keys, first | last} | <a href="#type-common_option">common_option()</a>
 </code></pre>
 
 `object_format`: <br />
@@ -101,6 +101,19 @@ existing atom raises `badarg` exception. <br />
 - `attempt_atom`: Returns existing atom as `existing_atom` but returns a
 binary string if fails find one.
 
+`duplicate_map_keys`: <br />
+https://www.ietf.org/rfc/rfc4627.txt says that keys SHOULD be
+unique, but they don't have to be. Most JSON parsers will either
+give you the value of the first, or last duplicate property
+encountered. When `object_format` is `tuple` or `proplist` all
+duplicates are returned. When `object_format` is `map` by default
+the first instance of a duplicate is returned. Setting
+`duplicate_map_keys` to `last` will change this behaviour to return
+the last such instance.
+- If the value is `first` then the first duplicate key/value is returned.<br />
+- If the value is `last` then the last duplicate key/value is returned.
+- default: `first`<br />
+
 
 
 ### <a name="type-encode_option">encode_option()</a> ###
@@ -220,7 +233,7 @@ json_object() = <a href="#type-json_object_format_tuple">json_object_format_tupl
 
 
 <pre><code>
-json_object_format_map() = #{}
+json_object_format_map() = map()
 </code></pre>
 
 

+ 2 - 2
src/jsone.erl

@@ -134,7 +134,7 @@
 %% - The encoded string will contain at most `Decimals' number of digits past the decimal point. <br />
 %% - If `compact' is provided the trailing zeros at the end of the string are truncated. <br />
 %%
-%% For more details, see <a href="http://erlang.org/doc/man/erlang.html#float_to_list-2">erlang:flaot_to_list/2</a>.
+%% For more details, see <a href="http://erlang.org/doc/man/erlang.html#float_to_list-2">erlang:float_to_list/2</a>.
 %%
 %% ```
 %% > jsone:encode(1.23).
@@ -206,7 +206,7 @@
 %% `canonical_form': <br />
 %% - produce a canonical form of a JSON document <br />
 %%
-%% `{float_format, Optoins}':
+%% `{float_format, Options}':
 %% - Encodes a `float()` value in the format which specified by `Options' <br />
 %% - default: `[{scientific, 20}]' <br />
 %%