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

Add decoding parts to the undefined_as_null documentation

Heinz N. Gies 7 лет назад
Родитель
Сommit
3f565a2d1a
3 измененных файлов с 3 добавлено и 2 удалено
  1. 1 0
      README.md
  2. 1 1
      doc/jsone.md
  3. 1 1
      src/jsone.erl

+ 1 - 0
README.md

@@ -176,6 +176,7 @@ Erlang                  JSON             Erlang
 =================================================================================================
 
 null                   -> null                       -> null
+undefined              -> null                       -> undefined                  % undefined_as_null
 true                   -> true                       -> true
 false                  -> false                      -> false
 <<"abc">>              -> "abc"                      -> <<"abc">>

+ 1 - 1
doc/jsone.md

@@ -126,7 +126,7 @@ encode_option() = native_utf8 | canonical_form | {float_format, [<a href="#type-
 - default: `0` <br />
 
 `undefined_as_null`: <br />
-- Encodes atom `undefined` as null value <br />
+- Treats `undefined` in Erlang as the conversion target for `null` in JSON. This means that `undefined` will be encoded to `null` and `null` will be decoded to `undefined`<br />
 
 
 

+ 1 - 1
src/jsone.erl

@@ -222,7 +222,7 @@
 %% - default: `0' <br />
 %%
 %% `undefined_as_null': <br />
-%% - Encodes atom `undefined' as null value <br />
+%% - Treats `undefined' in Erlang as the conversion target for `null' in JSON. This means that `undefined' will be encoded to `null' and `null' will be decoded to `undefined'<br />
 
 -type decode_option() :: {object_format, tuple | proplist | map}
                        | {allow_ctrl_chars, boolean()}