I want JSON in below format, from PHP array,
How should I write PHP array and How should I convert it to JSON to get specific output in below format
{
"value": [
"01GQSE92030S8MNA78WQZ09JJQ",
"{n"user_id": "{{current_user.id}}",n"user_phone": "{{current_user.phone}}",n"ticket_id": "{{ticket.id}}",n"ticket_comment": "{{ticket.latest_comment}}",n"ticket_comment_author": "{{ticket.latest_comment.author.name}}",n"organization_id": "{{ticket.organization.external_id}}",n"organization_name": "{{ticket.organization.name}}",n"requester_name": "{{ticket.requester.name}}",n"requester_phone": "{{ticket.requester.phone}}"n}"
]
}
I tried below PHP array with json_encode, but output is not in required format,
array(
"value" => "01GQSE92030S8MNA78WQZ09JJQ",
array(
"user_id" => "{{current_user.id}}",
"user_phone" => "{{current_user.phone}}",
"ticket_id" => "{{ticket.id}}",
"ticket_comment" => "{{ticket.latest_comment}}",
"ticket_comment_author" => "{{ticket.latest_comment.author.name}}",
"organization_id" => "{{ticket.organization.external_id}}",
"organization_name" => "{{ticket.organization.name}}",
"requester_name" => "{{ticket.requester.name}}",
"requester_phone" => "{{ticket.requester.phone}}",
"agent_external_id" => "{{current_user.external_id}}",
"ticket_external_id" => "{{ticket.external_id}}",
"customer_external_id" => "{{ticket.requester.external_id}}"
)
);