Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to read an json format text

Posted on 2014-04-01
6
Medium Priority
?
433 Views
Last Modified: 2014-04-01
hi, i am new to this, so i am using an api and the result of some function is this below:

this is an string:

{"id":"MLB550992919","site_id":"uuuu","title":"Produto Teste - Testando ","subtitle":"Subtitulo Do Produvo Vai Aqui","seller_id":11921150,"category_id":"MLB12871","official_store_id":null,"price":11,"base_price":11,"currency_id":"BRL","initial_quantity":10,"available_quantity":10,"sold_quantity":0,"buying_mode":"buy_it_now","listing_type_id":"bronze","start_time":"2014-04-01T00:17:03.091Z","stop_time":"2014-05-31T00:17:03.091Z","end_time":"2014-05-31T00:17:03.091Z","condition":"new","permalink":"http://com.br/MLB-550992919--_JM","thumbnail":"http://www..com/jm/img?s=STC&v=I&f=proccesing_image_pt.jpg","secure_thumbnail":"https://we.com/jm/img?s=STC&v=I&f=proccesing_image_pt.jpg","pictures":[{"id":"MLB6078401592_032014","url":"http://www.om/jm/img?s=STC&v=O&f=proccesing_image_pt.jpg","secure_url":"https://wwcom/jm/img?s=STC&v=O&f=proccesing_image_pt.jpg","size":"500x500","max_size":"500x500","quality":""}]"date_created":"2014-04-01T00:17:03.310Z","last_updated":"2014-04-01T00:17:03.310Z"}

so, how can i get those variables values from this mess above, what can i use it.
0
Comment
Question by:rafaelrgl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39968997
this might help, using the framework function Json.Decode:
http://msdn.microsoft.com/en-us/library/gg538324%28v=vs.111%29.aspx
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39969005
You need to create a class and use the appropriate component. I have published an article on it. Check http://emoreau.com/Entries/Articles/2014/01/Using-JsonNet.aspx
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 39969889
i am trying but not having success, can you give me sample using my string and return site_id result
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 39969964
public partial class Form1 : Form
      {
            public Form1()
            {
                  InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                  var x = "{'id':'MLB550992919','site_id':'uuuu','title':'Produto Teste - Testando ','subtitle':'Subtitulo Do Produvo Vai Aqui','seller_id':11921150,'category_id':'MLB12871','official_store_id':null,'price':11,'base_price':11,'currency_id':'BRL','initial_quantity':10,'available_quantity':10,'sold_quantity':0,'buying_mode':'buy_it_now','listing_type_id':'bronze','start_time':'2014-04-01T00:17:03.091Z','stop_time':'2014-05-31T00:17:03.091Z','end_time':'2014-05-31T00:17:03.091Z','condition':'new','permalink':'http://com.br/MLB-550992919--_JM','thumbnail':'http://www..com/jm/img?s=STC&v=I&f=proccesing_image_pt.jpg','secure_thumbnail':'https://we.com/jm/img?s=STC&v=I&f=proccesing_image_pt.jpg','pictures':[{'id':'MLB6078401592_032014','url':'http://www.om/jm/img?s=STC&v=O&f=proccesing_image_pt.jpg','secure_url':'https://wwcom/jm/img?s=STC&v=O&f=proccesing_image_pt.jpg','size':'500x500','max_size':'500x500','quality':''}],'date_created':'2014-04-01T00:17:03.310Z','last_updated':'2014-04-01T00:17:03.310Z'}";
                  DemoClass dc = JsonConvert.DeserializeObject<DemoClass>(x);

                  var r = dc.id;
            }
      }

      class DemoClass
      {
            public string id;
            public string site_id;
      }
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39969967
BTW, your json string was missing a , just before date_created!
0
 
LVL 1

Author Closing Comment

by:rafaelrgl
ID: 39970025
thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question