When you use the FOR JSON clause, you can specify the structure of the JSON output explicitly, or let the structure of the SELECT statement determine the output.
- To maintain full control over the format of the JSON output, use FOR JSON PATH. You can create wrapper objects and nest complex properties.
- To format the JSON output automatically based on the structure of the SELECT statement, use FOR JSON AUTO.
Example:
SELECT name, surname
FROM emp
FOR JSON AUTO;
Result:
No comments:
Post a Comment