You really need to do this on the server rather than in javascript on the browser as the latter exposes your API key to the world (and probably violates Asana's terms of service)
Look at the API docs (https://asana.com/developers/api-reference/tasks) under the heading "QUERYING FOR TASKS" to get the details. From the command line you would type the following (assuming you have curl):
curl -u <api_key>: "https://app.asana.com/api/1.0/tasks?workspace=14916&assignee=me"
Most server side languages will have a mechanism for doing the equivalent from within a script.
If you need the json delivered to the browser, you would:
- Fire off an AJAX request to the server, providing the appropriate details
- In your script convert the request into a call to the Asana API (adding your API Key)
- Receive result on the server from Asana and echo to client.
- Process JSON in javascript.
Bear in mind that this is potentially an expensive operation in terms of the performance of your server. Depending on the setup/language you are using, you may need to plan carefully to ensure that the Asana api requests are not blocking other requests (they need to happen asynchronously).