Fixes assertion triggered by parse_package_metadata() and json_build(). (cherry picked from commit d090049c)