json
json copied to clipboard
IPAddr#to_json remove prefix address with CIDR
IPAddr#to_json removed the prefix address with IPAddr/CIDR value. It unable to deserialize IPAddr/CIDR value.
Expected behavior
require 'date'
require 'json'
IPAddr.new('172.16.0.0/24').to_json #=> "\"172.16.0.0/24\""
Actual behavior
require 'ipaddr'
require 'json'
IPAddr.new('172.16.0.0/24').to_json #=> "\"172.16.0.0\""
Related URL
- https://github.com/rails/rails/issues/46006