Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 367efdb

Browse filesBrowse files
MehGokalpwouterj
authored andcommitted
JsonResponse content updated
1 parent e16bc4e commit 367efdb
Copy full SHA for 367efdb

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎components/http_foundation.rst

Copy file name to clipboardExpand all lines: components/http_foundation.rst
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,11 @@ class, which can make this even easier::
668668
// if you know the data to send when creating the response
669669
$response = new JsonResponse(['data' => 123]);
670670

671-
// if you don't know the data to send when creating the response
671+
// if you don't know the data to send or if you want to customize the encoding options
672672
$response = new JsonResponse();
673673
// ...
674+
// configure any custom encoding options (if needed, it must be called before "setData()")
675+
//$response->setEncodingOptions(JsonResponse::DEFAULT_ENCODING_OPTIONS | \JSON_PRESERVE_ZERO_FRACTION);
674676
$response->setData(['data' => 123]);
675677

676678
// if the data to send is already encoded in JSON

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.