diff options
author | Chris Seaton <chris.seaton@shopify.com> | 2020-10-07 03:13:48 +0100 |
---|---|---|
committer | Chris Seaton <chris.seaton@shopify.com> | 2020-10-07 17:28:13 +0100 |
commit | b8c1c640cd375f2e2ccca1b18bf943f80ad04816 (patch) | |
tree | fba7e360e7768522e7569a7c07bee4c72e6bfc50 /lib | |
parent | 07c34048ff758c81be9d8b30f5d63084e5e9e072 (diff) | |
download | json-b8c1c640cd375f2e2ccca1b18bf943f80ad04816.tar.gz |
Fix an issue with generate_pretty and empty objects in the Ruby and Java implementations
Diffstat (limited to 'lib')
-rw-r--r-- | lib/json/pure/generator.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index ef1c2e8..2257ee3 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -332,8 +332,10 @@ module JSON first = false } depth = state.depth -= 1 - result << state.object_nl - result << state.indent * depth if indent + unless first + result << state.object_nl + result << state.indent * depth if indent + end result << '}' result end |