i found this framewok , it seem easy to user , http://stig.github.com/json-framework/. In the exemple , he have this json :
{
“resultats”:{
“joueurs”:[
{
“nom”:”Jean Martin”,
“score”:10000
},
{
“nom”:”Pierre Dupond”,
“score”:”9000″
},
{
“nom”:”Alice Bateau”,
“score”:”8500″
}
]
}
}
and he parase it like this :
NSDictionary *json = [myJSON JSONValue];
//récupération des résultats
NSDictionary *resultats = [json objectForKey:@"resultats"];
//récupération du tableau de Jouers
NSArray *listeJoueur = [resultats objectForKey:@"joueurs"];
//On parcourt la liste de joueurs
for (NSDictionary *dic in listeJoueur) {
//création d'un objet Joueur
Joueur *joueur = [[Joueur alloc] init];
//renseignement du nom
joueur.nom = [dic objectForKey:@"nom"];
//renseingement du score
joueur.score = [[dic objectForKey:@"score"] intValue];
But me ,i don’t have array in my JSON . This is my json :
{“escarrival”:”NCE”,”escdepart”:”DJE”,”estarrival”:”08.24″,”estdepart”:”06.27″,”flynumber”:”TU
0286″,”fstatuts”:”Vol
atterri”,”proarrival”:”08.25″,”prodepart”:”06.30″,”realarrived”:”—-“,”realdepart”:”06.27″}
How can i parase it please ? thankx
You don’t need to pars it just extract the objects for the keys.
Edit:
For better understanding of NSDictionary read Collections Programming Topics from Apple