sile / jsone

Erlang JSON library
MIT License
291 stars 71 forks source link

Fix a bug of `skip_undefined` encoding option #54

Closed sile closed 3 years ago

sile commented 3 years ago

The skip_undefined option, which introduced by #53, has a bug such that if an entry having the undefined value is placed at the last in an object, the encoded JSON object has an extra comma as follows:

> jsone:encode(#{a => [#{a => undefined, b => c, d => undefined}]}, [skip_undefined]).
<<"{\"a\":[{\"b\":\"c\",}]}">> 

This PR fixes the bug.