JSON filters
Chainable query builder
Works with your DTOs
Try ServiceQuery
Paste a query request JSON (e.g. { "filters": [] }) and submit.
Or click an example below to populate the editor.
Endpoint
POST https://ServiceQuery.com/api/ExampleServiceQuery
Body { "filters": [...] }
Query
Edit JSON then click Submit.
Result
This demo prints API output as-is.
Ready.
Examples
Click Use to load an example into the editor.
Employee model
Examples below use these property names.
Id (int)
FirstName (string)
LastName (string)
HireDate (DateTimeOffset?)
Salary (decimal)
Title (string)
Department (string)
Controller example
This is the in-memory async controller used by the demo page.
// In-memory data set (no database)
private static readonly List<Employee> Employees = BuildSeedEmployees();
[HttpPost]
[Route("api/ExampleServiceQuery")]
public ActionResult<ServiceQueryResponse<Employee>> ExampleServiceQuery([FromBody] ServiceQueryRequest request)
{
try
{
if (request == null || request.Filters == null)
throw new Exception("error");
var queryable = Employees.AsQueryable();
return Ok(request.Execute(queryable));
}
catch
{
return BadRequest("There was an error processing your request");
}
}
Notes
- Queries are sent as JSON with a
filtersarray. - String operators:
contains,startswith,endswith. - Comparisons:
equal,notequal,greaterthan,greaterthanorequal,lessthan,lessthanorequal,between. - Aggregates:
count,sum,average,minimum,maximum. - Paging uses
pagenumber,pagesize, and optionallyincludecount.