# -*- coding: utf-8 -*-
class Array
  def to_pdf_json(options = {})
    json = self.to_json(options)
    json.gsub!(/\\([\\\/]|u[[:xdigit:]]{4})/) do
      ustr = $1
      if ustr.starts_with?('u')
        [ustr[1..-1].to_i(16)].pack("U")
      elsif ustr == '\\'
        '\\\\'
      else
        ustr
      end
    end
    ActiveSupport::JSON.decode(json)
  end
end
