Skip to content

More clear description of sendJSON() method - #1061

Closed
mildabre wants to merge 150 commits into
nette:masterfrom
mildabre:patch-18
Closed

More clear description of sendJSON() method#1061
mildabre wants to merge 150 commits into
nette:masterfrom
mildabre:patch-18

Conversation

@mildabre

@mildabre mildabre commented Nov 2, 2024

Copy link
Copy Markdown
Contributor

I propose describe the function of sendJSON() method more clear, in current version is written: "Příklad action-metody, která odešle data ve formátu JSON", but the data are sent not by action method, but by sendJSON() method.

Also it is important add info, that the data are both encoded into JSON and send as http response, to avoid confusing that you should pass into the method data already encoded in JSON - small difference in meaning but important!

@dg
dg force-pushed the master branch 29 times, most recently from e0bc7f4 to 3c92c82 Compare December 18, 2024 14:49
@dg

dg commented Jul 5, 2026

Copy link
Copy Markdown
Member

Thanks, both points are valid — the sending is done by sendJson(), not the action method, and it's worth making clear the method encodes the data (you pass a raw array/object, not pre-encoded JSON). I verified the signature (sendJson(mixed $data): void). Incorporated in the next commit, in both languages: "The sendJson($data) method encodes the given data into JSON, sends it as the HTTP response, and terminates the presenter. Example:" — kept the trailing "Example:" so it still introduces the code sample below. Closing since the branch can't be merged directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.