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…

Details

Retrieve key from max value in multidimensional associativ array

I try to get the key from the largest value inside an multidimensional array. Here is my sample array $resultCache[129] = [ ‘total’ => 1000, ‘free_from’ => “2000”, ‘addinupshippingcosts’ => “0”, ‘articles’ => [ [‘shipping_costs_total’ => 25], //<= i want the key of this array entry [‘shipping_costs_total’ => 12], ] ]; First I thought I…

Details

Angular ngIf router has /id ( /a dynamic number )

I have created this in the main.ts which gets the route url: router: string; constructor(private _router: Router) { this.router = _router.url; } This works well. Then in the main.html: <app-main-menu *ngIf=”router == ‘/'”></app-main-menu> <app-item-list *ngIf=”router == ‘/list'”></app-item-list> <app-item-info *ngIf=”router == ‘/:id'”></app-item-info> <!– THIS DOES NOT WORK –> When the route is /2 or /35 (or…

Details

Is running new thread in Timer.5 boost::asio tutorial necessary?

Question 1: Is starting a new thread in Timer.5 boost::asio tutorial really needed? … boost::thread t(boost::bind(&boost::asio::io_context::run, &io)); io.run(); t.join(); … Tutorial says: As you already know, the asio library provides a guarantee that callback handlers will only be called from threads that are currently calling io_context::run(). But if I run this … // boost::thread t(boost::bind(&boost::asio::io_context::run,…

Details

jq filter out specific pattern

I would like to retrieve the pointURL of the following JSON via jq. In other words, how can I get the pointURL”: “http://10.1.1.64:21138“ ? { “id”: “b8e07db15f30”, “configuration”: “{\r\n \”encd\”: [\r\n {\r\n \”name\”: \”hello\”,\r\n \”raiseOnError\”: true,\r\n \”type\”: \”version3\”,\r\n \”encdpecific\”: {\r\n \”apiURL\”: \”http://172.29.32.32/new/rest\”,\r\n \”apiURLB\”: \”http://172.29.32.32/new/rest\”,\r\n \”IDname\”: 92,\r\n \”startno\”: 5000,\r\n \”support\”: true\r\n },\r\n \”ServerURL\”: {\r\n \”type\”: \”ServerNEW\”,\r\n…

Details