[Fixes #14948] Hash#to_query: Changed a way how empty hash and empty array are serialized

Empty Hash or Array should not present in serialization result

    {a: []}.to_query # => ""
    {a: {}}.to_query # => ""

For more info see #14948.
Merge pull request #14949 from bogdan/empty-hash-array-parameterization

[Fixes #14948] Hash#to_query: right serialization for  empty hash and array