[erlang-questions] New project: ZJ - A tiny JSON encoder/decoder
Michael Nisi
michael.nisi@REDACTED
Wed Jun 27 09:42:14 CEST 2018
Here’s how v8::JSON, the JSON parser in Node’s JavaScript engine, does it:
> JSON.stringify({})
'{}'
> JSON.stringify({ name: null })
'{"name":null}'
> JSON.stringify({ name: undefined })
'{}'
> JSON.stringify({ name: 'Lionel' })
'{"name":"Lionel"}’
> JSON.parse('{}').name
undefined
> JSON.parse('{ "name": null }').name
null
JavaScript differentiates between null and undefined, without wanting to get philosophical here.
Michael
> On 27. Jun 2018, at 09:21, zxq9@REDACTED wrote:
>
> Erlang -> JSON
> - true -> true
> - false -> false
> - undefined -> null
> - Atom -> String
>
> JSON -> Erlang
> - true -> true
> - false -> false
> - null -> undefined
>
More information about the erlang-questions
mailing list