Ruby to_json encode cyrillic into unicode

I have a hash object with cyrilic text like this

payload = {'date': "30",'name': 'Тест','phone': "71234567890",'sum': "0",'offer_id': "1"}

I need to convert it to json and send to php api service like this

{"date":"30","name":"\u0422\u0435\u0441\u0442","offer_id":"1","phone":"71234567890","sum":"0"}

But to_json returns me

{"date":"30","name":"Тест","offer_id":"1","phone":"71234567890","sum":"0"}

How do I encode cyrilic into unicode in that case? Do I need to pass options to to_json method?

Leave a Reply

Your email address will not be published. Required fields are marked *