Closed
Description
This test demonstrates my issue
test 'ignore_nil! within array' do
result = jbuild do |json|
json.ignore_nil! true
json.array! [{ name: 'Bob', dne: nil }]
end
assert_equal ['name'], result[0].keys
result = jbuild do |json|
json.ignore_nil! false
json.array! [{ name: 'Bob', dne: nil }]
end
assert_equal ['name', 'dne'], result[0].keys
end
I'm afraid I couldn't work out how to fix it. Additionally I noticed that the test shows a symbol key is returned instead of a key, which might be related to the issue.
diff:
- ["name", "dne"]
? ^ - ^ -
+ [:name, :dne]