IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Parser JSON C#


Sujet :

C#

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Mars 2011
    Messages : 42
    Par défaut Parser JSON C#
    Slt le forum, j'essaie en vain de parser le flux foursquare.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     var address = new Uri("https://api.foursquare.com/v2/venues/search?ll=40.7,-74");
                var client = new WebClient();
                client.DownloadStringCompleted +=ClientDownloadStringCompleted;
                client.DownloadStringAsync(address);
    Et

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     private static void ClientDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
            {
     
                var responseStream = e.Result;
                var raw = e.Result;
                JsonArray k;
                if (JsonValue.Parse(raw) as JsonArray == null)
                    k = new JsonArray { JsonValue.Parse(raw) as JsonObject };
                else
                    k = JsonValue.Parse(raw) as JsonArray;
     
     
     
                foreach (JsonObject jo in k)
                {
     
                //     id = (string)item.Element("id"),
                //            name = (string)item.Element("name"),
                //            address = (string)item.Element("address"),
                //            city = (string)item.Element("city"),
                //            state = (string)item.Element("state"),
                //            zip = (string)item.Element("zip"),
                //            geolat = (string)item.Element("geolat"),
                //            geolong = (string)item.Element("geolong"),
                }
    Mais je n'arrive pas à parser le flux json. Quelqu'un a une idée ?

    Merci

  2. #2
    Membre expérimenté
    Profil pro
    Mangeur de gauffre
    Inscrit en
    Octobre 2007
    Messages
    4 413
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Mangeur de gauffre

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 413
    Par défaut
    Citation Envoyé par techgeom
    Mais je n'arrive pas à parser le flux json.
    C'est a dire ?
    Peux tu etre plus precis ?

    Le bout de code que tu donne n'eclaire pas vraiment sur ton problème

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Mars 2011
    Messages : 42
    Par défaut
    J'essaie de convertir le flux json en objet.
    Voici un bout du flux json.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    {
    meta: {
    code: 200
    }
    response: {
    groups: [
    {
    type: "trending"
    name: "Trending Now"
    items: [
    {
    id: "49e3e886f964a520ea621fe3"
    name: "Brooklyn Tabernacle"
    contact: { }
    location: {
    address: "17 Smith St"
    crossStreet: "Jay and Lawrence St"
    city: "Brooklyn"
    state: "NY"
    postalCode: "11201"
    lat: 40.691
    lng: -73.9876
    distance: 1448
    }
    categories: []
    verified: false
    stats: {
    checkinsCount: 591
    usersCount: 206
    }
    todos: {
    count: 0
    }
    hereNow: {
    count: 8
    }
    }
    Je voudrais récuperer id,name,contact,location,address.... de chaque item.
    Merci

  4. #4
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Avril 2006
    Messages
    1 627
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 627
    Par défaut
    JsonValue.Parse ressemble à quoi ? Combien d'éléments as-tu dans ton Array avant de passer dans le foreach ?

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Mars 2011
    Messages : 42
    Par défaut
    JsonValue.Parse ressemble à

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    {"meta":{"code":200},"response":{"groups":[{"type":"trending","name":"Trending Now","items":[{"id":"49e3e886f964a520ea621fe3","name":"Brooklyn Tabernacle","contact":{},"location":{"address":"17 Smith St","crossStreet":"Jay and Lawrence St","city":"Brooklyn","state":"NY","postalCode":"11201","lat":40.691,"lng":-73.9876,"distance":1448},"categories":[{"id":"4bf58dd8d48988d132941735","name":"Churches","icon":"http:\/\/foursquare.com\/img\/categories\/building\/religious_church.png","parents":["Home \/ Work \/ Other","Religious Centers"],"primary":true},{"id":"4bf58dd8d48988d131941735","name":"Religious Centers","icon":"http:\/\/foursquare.com\/img\/categories\/building\/religious.png","parents":["Home \/ Work \/ Other"]}],"verified":false,"stats":{"checkinsCount":591,"usersCount":206},"todos":{"count":0},"hereNow":{"count":7}},{"id":"4c757abb3adda1432e7707af","name":"New York Law School","contact":{"phone":"2124312100","twitter":"nylawschool"},"location":{"address":"185 W Broadway","crossStreet":"at Worth St","city":"New York","state":"NY","postalCode":"10013","lat":40.718005536050974,"lng":-74.00696396827698,"distance":2088},"categories":[{"id":"4bf58dd8d48988d1a6941735","name":"Law Schools","icon":"http:\/\/foursquare.com\/img\/categories\/education\/default.png","parents":["Colleges & Universities"],"primary":true}],"verified":true,"stats":{"checkinsCount":1488,"usersCount":217},"todos":{"count":0},"hereNow":{"count":9}}]},{"type":"nearby","name":"Nearby","items":[{"id":"4b81ea40f964a520e0c330e3","name":"Brooklyn Bridge Park - Pier 1","contact":{},"location":{"address":"334 Furman Street","city":"Brooklyn","state":"NY","postalCode":"11201","lat":40.701984159668676,"lng":-73.9969539642334,"distance":338},"categories":[{"id":"4bf58dd8d48988d163941735","name":"Parks","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":3923,"usersCount":2605},"todos":{"count":0},"hereNow":{"count":0}},{"id":"42377700f964a52024201fe3","name":"Brooklyn Heights Promenade","contact":{},"location":{"address":"Columbia Heights","crossStreet":"btw Montague and Middagh","city":"Brooklyn","state":"NY","postalCode":"11201","lat":40.69829137715981,"lng":-73.99663209915161,"distance":342},"categories":[{"id":"4bf58dd8d48988d163941735","name":"Parks","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true},{"id":"4bf58dd8d48988d1e7941735","name":"Playgrounds","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/playground.png","parents":["Great Outdoors"]},{"id":"4bf58dd8d48988d165941735","name":"Scenic Lookouts","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"]}],"verified":false,"stats":{"checkinsCount":3559,"usersCount":1508},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c48dc0520ab1b8d6118fd15","name":"Movies With A View","contact":{},"location":{"lat":40.701781,"lng":-73.997748,"distance":274},"categories":[{"id":"4bf58dd8d48988d162941735","name":"Other Great Outdoors","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":95,"usersCount":56},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c3a5ad83849c92880e0c2b1","name":"Blue Marble Ice Cream","contact":{},"location":{"address":"Brooklyn Bridge Park - Pier 1","city":"Brooklyn","state":"NY","postalCode":"11201","lat":40.70136599888968,"lng":-73.99794101715088,"distance":230},"categories":[{"id":"4bf58dd8d48988d1c9941735","name":"Ice Cream Shops","icon":"http:\/\/foursquare.com\/img\/categories\/food\/icecream.png","parents":["Food"],"primary":true}],"verified":false,"stats":{"checkinsCount":68,"usersCount":53},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c3f7d0cff711b8d68fd0e05","name":"75 Wall Street Gym","contact":{},"location":{"city":"New York","state":"New York","lat":40.700821,"lng":-74.001984,"distance":190},"categories":[{"id":"4bf58dd8d48988d176941735","name":"Gyms","icon":"http:\/\/foursquare.com\/img\/categories\/building\/gym.png","parents":["Home \/ Work \/ Other","Gyms or Fitness Centers"],"primary":true}],"verified":false,"stats":{"checkinsCount":81,"usersCount":39},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4b8f057af964a520184533e3","name":"Exchange Hotel","contact":{},"location":{"city":"New York","state":"New York","lat":40.700521,"lng":-74.001527,"distance":141},"categories":[{"id":"4bf58dd8d48988d121941735","name":"Lounges","icon":"http:\/\/foursquare.com\/img\/categories\/nightlife\/lounge.png","parents":["Nightlife Spots"],"primary":true}],"verified":false,"stats":{"checkinsCount":33,"usersCount":12},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c0ad81b009a0f47ff2ceabf","name":"Yeasayer Boat Of ROCK","contact":{},"location":{"city":"Brooklyn","state":"New York","postalCode":"11201","lat":40.697134,"lng":-74.00022,"distance":319},"categories":[{"id":"4bf58dd8d48988d12d951735","name":"Boats or Ferries","icon":"http:\/\/foursquare.com\/img\/categories\/travel\/boat.png","parents":["Travel Spots"],"primary":true}],"verified":false,"stats":{"checkinsCount":32,"usersCount":29},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c67633d8e9120a1d3ddda64","name":"Shroud Park","contact":{},"location":{"address":"Park Place","crossStreet":"Washington","city":"Brooklyn","state":"New York","postalCode":"11238","lat":40.7012193,"lng":-73.9973273,"distance":263},"categories":[{"id":"4bf58dd8d48988d163941735","name":"Parks","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":18,"usersCount":17},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c704f0334443704e4cc235f","name":"Spiral Pool","contact":{},"location":{"city":"Brooklyn","state":"New York","postalCode":"11201","lat":40.698981285095215,"lng":-73.99768352508545,"distance":226},"categories":[{"id":"4bf58dd8d48988d165941735","name":"Scenic Lookouts","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":13,"usersCount":12},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c2cd3d38abca593ac4e0220","name":"The Arena","contact":{},"location":{"city":"New York","state":"New York","lat":40.701164,"lng":-74.001253,"distance":167},"categories":[],"verified":false,"stats":{"checkinsCount":9,"usersCount":2},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4d00096e6923721ec97cc23b","name":"My Palatial Estate","contact":{},"location":{"state":"New York","lat":40.70251,"lng":-73.998345,"distance":312},"categories":[],"verified":false,"stats":{"checkinsCount":40,"usersCount":1},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c5c631c94fd0f47af7ec845","name":"Shuttle Train","contact":{},"location":{"address":"Park Place","crossStreet":"Franklin avenue","city":"Brooklyn","state":"New York","postalCode":"11216","lat":40.7017332,"lng":-73.9965928,"distance":346},"categories":[{"id":"4bf58dd8d48988d1fd931735","name":"Subways","icon":"http:\/\/foursquare.com\/img\/categories\/travel\/subway.png","parents":["Travel Spots"],"primary":true}],"verified":false,"stats":{"checkinsCount":19,"usersCount":7},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4cb9e251adcd54817d881fa2","name":"The Smoking Circle","contact":{},"location":{"lat":40.699856,"lng":-73.995876,"distance":348},"categories":[],"verified":false,"stats":{"checkinsCount":49,"usersCount":5},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4b7c8bedf964a5202c9a2fe3","name":"160 Columbia Heights","contact":{},"location":{"address":"160 Columbia Heights","city":"Brooklyn","state":"NY","lat":40.698296,"lng":-73.996675,"distance":338},"categories":[],"verified":false,"stats":{"checkinsCount":47,"usersCount":4},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c2fbe00ed37a59340d86703","name":"Fort Stirling Park","contact":{},"location":{"address":"Columbia Heights","crossStreet":"Clark St","city":"Brooklyn","state":"NY","lat":40.6990109,"lng":-73.996,"distance":355},"categories":[{"id":"4bf58dd8d48988d163941735","name":"Parks","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":31,"usersCount":16},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c4b1b6b9c8d2d7f9c41826a","name":"Wow House rehearsal space","contact":{},"location":{"address":"Park","crossStreet":"Grand","city":"Brooklyn","state":"NY","lat":40.7012193,"lng":-73.9973273,"distance":263},"categories":[{"id":"4bf58dd8d48988d137941735","name":"Theaters","icon":"http:\/\/foursquare.com\/img\/categories\/arts_entertainment\/default.png","parents":["Arts & Entertainment","Performing Arts Venues"],"primary":true}],"verified":false,"stats":{"checkinsCount":8,"usersCount":5},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4cd38685558a37046ceec1a6","name":"Shawarma truck","contact":{},"location":{"address":"Wall st","crossStreet":"Water st","city":"New York","state":"New York","postalCode":"10005","lat":40.701133,"lng":-73.999322,"distance":138},"categories":[],"verified":false,"stats":{"checkinsCount":7,"usersCount":6},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c8191582f1c236a8e5e3143","name":"Brooklyn Promenade","contact":{},"location":{"city":"New York","state":"New York","lat":40.702858,"lng":-73.998399,"distance":345},"categories":[],"verified":false,"stats":{"checkinsCount":42,"usersCount":41},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c7150b8b5a5236a85a35252","name":"Yummy Coffee","contact":{},"location":{"city":"New York","state":"New York","lat":40.702122,"lng":-73.999742,"distance":237},"categories":[],"verified":false,"stats":{"checkinsCount":10,"usersCount":5},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c0077809cf52d7f4ce013e7","name":"Booze Cruise","contact":{"phone":"2126916693"},"location":{"address":"East 23rd St","crossStreet":"FDR Drive","city":"New York","state":"NY","postalCode":"10010","lat":40.703544,"lng":-74.001143,"distance":406},"categories":[{"id":"4bf58dd8d48988d11f941735","name":"Nightclubs","icon":"http:\/\/foursquare.com\/img\/categories\/nightlife\/danceparty.png","parents":["Nightlife Spots"],"primary":true}],"verified":false,"stats":{"checkinsCount":69,"usersCount":53},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c4672f91ddec9286aab9a32","name":"Opium Den","contact":{},"location":{"city":"Noen Phoem","state":"Thailand","lat":40.702122,"lng":-73.999742,"distance":237},"categories":[],"verified":false,"stats":{"checkinsCount":6,"usersCount":5},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c86983e74d7b60c4c80a5d8","name":"Hillside Park","contact":{},"location":{"address":"Columbia Heights","crossStreet":"Vine st.","city":"Brooklyn","state":"NY","lat":40.6990109,"lng":-73.996,"distance":355},"categories":[{"id":"4bf58dd8d48988d163941735","name":"Parks","icon":"http:\/\/foursquare.com\/img\/categories\/parks_outdoors\/default.png","parents":["Great Outdoors"],"primary":true}],"verified":false,"stats":{"checkinsCount":15,"usersCount":15},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c1d046bb4e62d7f43fcdb93","name":"Mannahatta Park","contact":{},"location":{"crossStreet":"South St and Wall St","city":"New York","state":"New York","lat":40.700281,"lng":-74.001472,"distance":128},"categories":[],"verified":false,"stats":{"checkinsCount":10,"usersCount":8},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4d50093edcce224b9ce8d31b","name":"Samantha's Vagina","contact":{},"location":{"city":"Boca Raton","state":"Florida","postalCode":"33498","lat":40.698978,"lng":-74.00043,"distance":119},"categories":[],"verified":false,"stats":{"checkinsCount":5,"usersCount":3},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c48d05e6594be9a1e573d24","name":"I'm The Dude.  So that's what you call me.","contact":{},"location":{"address":"Furman St.","city":"Brooklyn","state":"NY","lat":40.6974964,"lng":-73.9975451,"distance":347},"categories":[{"id":"4bf58dd8d48988d1e4931735","name":"Bowling Alleys","icon":"http:\/\/foursquare.com\/img\/categories\/arts_entertainment\/bowling.png","parents":["Arts & Entertainment"],"primary":true}],"verified":false,"stats":{"checkinsCount":10,"usersCount":8},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4bf5c1a15e800f47f326e6d4","name":"Fino's","contact":{},"location":{"city":"New York","state":"New York","lat":40.700396,"lng":-74.001432,"distance":128},"categories":[],"verified":false,"stats":{"checkinsCount":4,"usersCount":4},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c90de437f3b8cfa65b7971e","name":"Taxi 4N62","contact":{},"location":{"city":"New York","state":"New York","lat":40.700249,"lng":-74.001442,"distance":124},"categories":[],"verified":false,"stats":{"checkinsCount":3,"usersCount":3},"todos":{"count":0},"hereNow":{"count":0}},{"id":"4c391bda2c8020a1ed2c8c00","name":"Angel's","contact":{},"location":{"city":"New York","state":"New York","lat":40.702607,"lng":-73.997774,"distance":345},"categories":[],"verified":false,"stats":{"checkinsCount":6,"usersCount":5},"todos":{"count":0},"hereNow":{"count":0}}]}]}}
    Je pensais faire une requete linq pour recuperer les items json comme je le fais pour le xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
       var q = from item in xmlTree.Descendants("user").Descendants("checkin").Descendants("venue")
                        select new Venue
                        {
                            id = (string)item.Element("id"),
                            name = (string)item.Element("name"),
                            address = (string)item.Element("address"),
                            city = (string)item.Element("city"),
                            state = (string)item.Element("state"),
                            zip = (string)item.Element("zip"),
                            geolat = (string)item.Element("geolat"),
                           geolong = (string)item.Element("geolong"),
                        };

  6. #6
    Membre expérimenté
    Profil pro
    Mangeur de gauffre
    Inscrit en
    Octobre 2007
    Messages
    4 413
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Mangeur de gauffre

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 413
    Par défaut
    Salut

    Si a chaque question tu reponds a coté on ne vas pas en sortir facilement

    1- Je te demandais que que tu voulais dire par "je ne parviens pas a parser"

    Tu reponds en montrant le flux Json : ca n'explique pas ta difficulté

    2 On te demande Json.Parse ca ressemble a quoi

    Tu reponds en montrant de nouveau ta trame json : on tourne en rond ...

    En tout cas ce que je peux te dire c'est que si le bout de code en commentaire de ton exemple c'est ce que tu avais exssayé alors c'est évident que ca ne vas pas le faire !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
                foreach (JsonObject jo in k)
                {
     
                //     id = (string)item.Element("id"),
                //            name = (string)item.Element("name"),
                //            address = (string)item.Element("address"),
                //            city = (string)item.Element("city"),
                //            state = (string)item.Element("state"),
                //            zip = (string)item.Element("zip"),
                //            geolat = (string)item.Element("geolat"),
                //            geolong = (string)item.Element("geolong"),
                }

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Mars 2011
    Messages : 42
    Par défaut
    Ok, olibara.
    Je souhaite simplement convertir le flux json Foursquare en objet.
    Ais-je répondu à ta question?

  8. #8
    Membre expérimenté
    Profil pro
    Mangeur de gauffre
    Inscrit en
    Octobre 2007
    Messages
    4 413
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Mangeur de gauffre

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 413
    Par défaut
    Citation Envoyé par techgeom Voir le message
    Ok, olibara.
    Je souhaite simplement convertir le flux json Foursquare en objet.
    Ais-je répondu à ta question?
    Non pas du tout !

    Que cherche tu ?
    Qu'on te donne un code tout fait pour faire ton travail ?
    On qu'on t'aide a trouver ce qui ne vas pas dans le code que tu a essayé

    Dans le premier cas je peux te comprendre mais je n'ai sincèrement pas le temps

    Dans le deuxieme cas tu n'a pas du tout expliqué le problème que tu rencontre !

  9. #9
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    42
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Mars 2011
    Messages : 42
    Par défaut
    Merci au forum silverlight

    There is no "Linq to JSon" so you can try different approach.
    First is to convert JSon to XML and then use LINQ to XML.
    Second is to used some libraries adding JSON to LINQ capabilities:
    http://json.codeplex.com/
    http://james.newtonking.com/archive/...json-beta.aspx
    http://blogs.msdn.com/b/mikeormond/a...q-to-json.aspx
    Faut des fois être conciliants avec les débutants...

  10. #10
    Membre expérimenté
    Profil pro
    Mangeur de gauffre
    Inscrit en
    Octobre 2007
    Messages
    4 413
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Mangeur de gauffre

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4 413
    Par défaut
    Faut des fois être conciliants avec les débutants...
    Oui sans doute mais quand tu cherche de l'aide et des réponses il faut aussi parvenir a poser les bonne questions

    Car en résumé tu a posé une question peu précise avec un bout de code qui n'informait en rien de la difficulté que tu rencontrais
    Et pour cause tu n'a reçu aucune réponse pertinente
    Et en définitive tu a trouvé tout seul car tu etais le seul a savoir ce que tu cherchais réellement !

  11. #11
    Rédacteur
    Avatar de Nathanael Marchand
    Homme Profil pro
    Expert .Net So@t
    Inscrit en
    Octobre 2008
    Messages
    3 615
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Expert .Net So@t
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2008
    Messages : 3 615
    Par défaut
    Sinon y'a aussi le datacontractjsonserializer:
    http://msdn.microsoft.com/en-us/libr...erializer.aspx

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. parser JSON double table de hash
    Par youshi dans le forum Ruby
    Réponses: 2
    Dernier message: 15/12/2010, 08h39
  2. parser JSON en CSHARP
    Par olibara dans le forum C#
    Réponses: 4
    Dernier message: 15/05/2010, 18h38
  3. Parser JSON avec $.getJSON jquery adaptation code
    Par MatthieuFourcade dans le forum jQuery
    Réponses: 2
    Dernier message: 22/06/2009, 10h17
  4. Comment Parser JSON
    Par mikaelm dans le forum Ruby
    Réponses: 1
    Dernier message: 01/04/2008, 22h54
  5. A la recherche d'un parser JSON
    Par hugo123 dans le forum Format d'échange (XML, JSON...)
    Réponses: 4
    Dernier message: 26/09/2006, 16h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo