Swift 2 Parse JSON Easily with One Line

preview_player
Показать описание
How to create the Facebook News Feed (Part 1):

Image Zooming Core Animation Tutorial:

Today we discuss how to easily parse JSON that come from either REST apis, web services, or static files. This is a task that many developers are faced with. However, many inconsistencies exist out there that lead to hard to maintain code and a proliferation of hacky Cocoapod libraries.

The solution presented in this video requires no third party library and only uses what Apple has provided to us. You'll see how easily it is to setup your custom Class Objects with all of the necessary properties coming in from your JSON service.

Google Json Parsing Challenge:

Here's the completed project:

Follow me on twitter!
Рекомендации по теме
Комментарии
Автор

This made me refactor my entire app, but it worth it, Thanks!

JorgeChavez
Автор

Awesome!!! Just watched all of them ) Especially last zooming animation)

begmuhammetkakabayev
Автор

You are legend.. this is what I was looking for. Keep it up!

PavlosNicolaou
Автор

Loving your videos! Please keep them coming!

LaurentShala
Автор

hi!, your tutorials are great ! :) i love them :D

gabrieljaramillo
Автор

Awesome tutorial! I am learning everyday more!

GermanMendoza
Автор

Great videos. Great delivery. I saw in your bio that you teach IOS development. Was wondering if your full class is available online somewhere?

dcirello
Автор

Love your tutorials. Have some slow time at work right now so I've been focusing on how to rely less on storyboards. Great work. I would really like to go through the paid courses you have on your site but 140$ for all three is kind of high. If I had to pick one of the three which do you strongly recommend?

sbassett
Автор

Hi, i watched ur videos related Parsing json, was useful.I have a quesion, Which one is best way 1.Parse data then save to core data then update UI? 2. Append parse data to struct then load UI, afterwards save to core data?

lydiaj
Автор

Thanks, I have a question here. How would I parse JSON from a URL ?
Here is what I did, its been complaining already
do {

let data = try(NSData(contentsOfURL: url!, options:
let jsonDictionary = try(NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers))


print(jsonDictionary["data"])

if let postDictionary = jsonDictionary["data"] as? [String: AnyObject] {
let post = Post()

}

//print(jsonDictionary)
}




my json here:
{
"data": [
{"id":"10", "name":"Vanitas", "price":"85", "img":"http:\/\/localhost\/img\/vanitas.jpeg", "description":"", "rate":"5"}
]
}

aalenazi
Автор

First of all thanks for your tutorials. i

The response I'm getting is in the format of array like
[
{ "user": "user1",
"name": "name"
},
{ "user": "user1",
"name": "name
}
]
I'm using alamofire object mapper to handle but since no key value its not mapping and always returning nil is there any way to handle this type of array response.

thanks in advance.

dineshnagarajandev
Автор

hey can you make a video how to connect to the webservice in xcode 8.2.1 swift 3 then call a method to receive a response from the webservice.

earlofdemisegaming
Автор

Hi, how we can convert complex JSON with dictionary and array with multiple parent-child to our class ?

iehsan
Автор

Hi,
firstly it is a fantastic video and I have really understood a good stuff. I have couple of question.
Q.1. if I wish to make alias of any key(because sometimes keys from JSON are weird), what I need to do?
Q2. How to handle description property and key ( because its generic in NSObject.)?
thanks in anticipation.

codeelsewhere
Автор

Hello. What if I want to get data from api and display that data when labels and etc. will display on the screen. As I understand I should work with Can you recommend me what do read or where I can find more information about this case. Thank you

IceJaffa
Автор

Hello,
I try to make an application for my organization and I arrived at the " Articles" .

I have a website and so a MySQL database using a PHPMyadmin containing all data (Articles etc .. )

I would use these same data in my application, for not having to create a new base in Firebase, and also have a plublier several times more support.

Do you know a method to allow me to do this? if so, can you help me please ?

kheirfidounia
Автор

hey, im looking for some way to create user login and logout using mysql

Sarrahadjayache
Автор

Hi Brian,

I am facing an issue in my app. In facebook app, images are not always in the feeds. Sometimes the feed has 1 image, sometimes it doesn't have(only text) and sometimes it does have multiple images. How to handle all these?. Please post a tutorial regarding this. it would be really good with JSON. your videos
Thanks

ashirvadaj
Автор

Hi, I m getting error :cannot convert value of type to expected argument type String :AnyObject while where my class is same in video..please help

amrutaahire
Автор

can we parse complete json array instead of looping

jkarthik