Didn't find this when I googled before, posting to maybe save the next person some time.

1 Answer 1


Maybe obvious for people familiar with Symfony, but was new for me; spent way too long trying to find something so simple:

$json_response = new JsonResponse($my_key_value_array);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.