Skip to content

Extra new line in pretty output when encoding empty hash #150

@akoldaev

Description

@akoldaev

Is there a reason for adding an extra \n when parsing an empty hash?
json is not adding it and it creates some issues when diff-ing pretty jsons generated with json and yajl-ruby.

[1]pry(main)> require 'yajl/json_gem'
true
[2]pry(main)> JSON.pretty_generate(a: {})
"{\n  \"a\": {\n\n  }\n}"

[3]pry(main)> require 'json'
true
[4]pry(main)> JSON.pretty_generate(a: {})
"{\n  \"a\": {\n  }\n}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions