Is it possible to send JSON from the server to my iOS app using Python?
How is something like this implemented?
(Django or Flask is fine)
I have searched online but only found PHP tutorials.
I have tried returning JSON but it did not work – or at least it never got sent to the app
The basic premise is that your client app sends a request a URL, and the server responds with JSON.
How you create the JSON document is not that important. You can use any language (even javascript) to generate the JSON and send it back.
For django there is tastypie, django-rest and piston.
For flask you can use flask-restful. Here is a complete example.
No matter which library you use, the workflow will go like this:
Now, if you want to implement a REST API, then you expand on the above to allow operations from the client app. For example, a specially crafted request can add new records, delete records or query for a subset of records. However, this is not a requirement if all you want to do is send JSON documents back to your application.