Search
ctrl/
Ask AI
Light
Dark
System

Shapes

Subtopics

Sometimes it's advantageous to get the shaped query results as a JSON structure instead of the native EdgeDB objects and types. Fortunately the only thing that's needed to achieve that is to cast the result of the query into json:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Notice that we used a full Account.username path expression without abbreviations; .username won't work here. This is because in this context the filter scope is now the json being selected and not the Account object. So an abbreviated path would fail (json has no links or properties), but a fully-qualified path is still able to be resolved to the same Account object that we're casting to json.

In practice you rarely need to perform this type of json cast explicitly. Our client libraries feature a query_json version along with the regular query functionality.