Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How to get and use JSON data from own website?

Hello fellow coders!

I am pretty new to iOS coding - I only have experience coding HTML, CSS and PHP. Anyway, I do want to know how to make iOS apps, so I have done the tutorial on this site.

Now I want to make and app that gets data from my own website using JSON. I already made the JSON page and it is working as it should. Where stuff went wrong, was when I wanted to get the data from the JSON site, and show it in the app. I do not know how to make the connection.

I currently have a JSON file that makes the query: SELECT * from people WHERE name = "". The thing is, that I want to show the age and the gender of the person, so the app should connect to my JSON page and post a name to the JSON page, and then retrieve the name, age and gender for, for example, a guy named jeremy.

Can anyone help me with that? Maybe even make some code I can work with? That would really be appreciated!

Have a nice day guys :-)

2 Answers

Hello Malthe,

I recommend taking a look at the Weather app course It covers Pulling Data From the Web which will give you a better understanding of what you need to do and how to do it.

If you don't want to do that check out the following blogPost

You can actually use Angular and nodejs to retrieve this json data, I've just done.