- json_encode: documentation ( source)
<?php
$extra = [
'affiliate_id' => '2222',
'description' => 'description',
'order_hash_public' => 'orderHashPublic',
];
$socialAuthItem['login'] = '1234sflfkjasdf';
$socialAuthItem['vterm_id'] = 'VKGolosa';
$extra['social_auth'][] = $socialAuthItem;
echo json_encode(['extra' => $extra], JSON_UNESCAPED_UNICODE);