J'utilise une requête GET à Shopify et Shopify renvoie un JSON ..données d'objet et d'affichage dictionnaire boucle
Je désérialisation JSON à l'objet ci-dessous (dictionnaire) ...
Comment puis-je parcourez l'objet ci-dessous et accédez uniquement à la paire de valeurs de clé "title" .
<code>
@using System.Web.Script;
@using System.Web.Script.Serialization;
@{
var url = string.Format("https://{0}.myshopify.com/admin/orders.json?
fields=billing_address", AppState["ShopName"]);
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/json";
request.Credentials=new
NetworkCredential((string)AppState["PrivateAppKey"],
(string)AppState["PrivateAppSecret"]);
request.PreAuthenticate = true;
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string urlText = reader.ReadToEnd(); // response from your url.
var jsonSerializer = new JavaScriptSerializer();
dynamic brokenJson = jsonSerializer.Deserialize<dynamic>(urlText);
}
</code>
Dictionary string "blogs" = object[] [0] = Dictionary string "id" = int 94686854 string "handle" = string "3d-printing" string "title" = string "3D Printing" string "updated_at" = string "2017-04-04T23:56:33+05:30" string "commentable" = string "moderate" string "feedburner" = string "" string "feedburner_location" = string "" string "created_at" = string "2017-04-04T23:56:33+05:30" string "template_suffix" = (null) string "tags" = string "" [1] = Dictionary string "id" = int 47272710 string "handle" = string "news" string "title" = string "News about ATRANGI" string "updated_at" = string "2017-04-07T13:20:45+05:30" string "commentable" = string "yes" string "feedburner" = string "Atrangi-LatestNews" string "feedburner_location" = string "http://feeds.feedburner.com/" string "created_at" = string "2016-01-06T20:56:04+05:30" string "template_suffix" = (null) string "tags" = string ""
S'il vous plaît montrer JSON et désérialisation. Cela va rendre beaucoup plus facile –
J'ai voté pour fermer cette question, car il n'est pas clair à lire. – Hackerman
@Gautam Sharma, est-ce que tu résous le problème? – gabba