Reference

JSON Procedure Handling

xtraq detects `FOR JSON` / `JSON_QUERY` projections and emits typed and raw helpers automatically.

What you get

  • Typed helper (ProcedureAsync) that deserialises JSON into record structs.
  • Raw helper (ProcedureRawAsync) that returns the JSON string.
  • Nested aliases and WITHOUT_ARRAY_WRAPPER are respected; JSON_QUERY stays intact.

Consume the result

var result = await db.UserListAsJsonAsync(input, ct);
var users = result.Result;          // typed list
var raw = result.ResultRawJson;     // raw JSON string
  • Arrays and single objects are supported; NULL yields an empty list or null.

Control null emission

{
  "ResultSet": { "Json": { "IncludeNullValues": true } }
}

Authoring tips

  • Prefer FOR JSON PATH for stable shapes; use WITHOUT_ARRAY_WRAPPER for single objects.
  • Alias nested properties with dotted names to get nested record structs.
  • Need endpoint patterns? See API Integration.