0

I am new in json. I want information user in various time and add them to diffrent lists.

My json text is like this -

{    "201322052":{  
  "Sat Aug 04 04:14:03":"https://blablabla",
  "Sat Aug 04 04:19:55":"https://blablabla2"},
"Doctor 201322052":{  
  "Sat Aug 04 04:19:35":"https://bla bla bla 3" }, 

"JrPwbApfIHbQhCUmVIoiVJcPYv93":{ 
"Sat Aug 04 04:02:47":{  
     "Misc":"sdasd",
     "Product":"asd",
     "address":"sd",
     "name":"Dr. Bua"
  },
  "Sat Aug 04 04:03:21":{  
     "Misc":"sdasd",
     "Product":"asd",
     "address":"sd",
     "name":"Dr. Bua"
  },
  "Sat Aug 04 04:03:28":{  
     "Misc":"sdasd",
     "Product":"asd",
     "address":"sd",
     "name":"Dr. Bua"
  },
  "Sat Aug 04 04:03:31":{  
     "Misc":"sdasd",
     "Product":"asd",
     "address":"sd",
     "name":"Dr. Bua"
  }
   }}

from a firebase database. I want to extract information of "JrPwbApfIHbQhCUmVIoiVJcPYv93" in this format-


DocName-----------Adress------Product----------Misc-------time


Dr. Bua---------Mirpur---------asd-------------sdsds------Sat Aug 04 04:02:47


Dr. Bua---------Mirpur---------asd-------------sdsds------Sat Aug 04 04:03:28


Dr. Bua---------Mirpur---------asd-------------sdsds------Sat July 04 04:03:28

I guess you get the idea. In my last question about extracting information I got a huge help from Mr. John Wu. I understand I need to do the same in here, but cannot get how to extract node "JrPwbApfIHbQhCUmVIoiVJcPYv93" from whole json separately and then apply that again.

Saikat halder
  • 548
  • 4
  • 11
  • 2
    Why didn't accept the answer provided to the question you liked to? – Nkosi Aug 04 '18 at 23:37
  • 1
    You can follow a similar structure for this data as well.. Load the JSON. get the desired key value as a JObject and parse it as a dictionary. – Nkosi Aug 04 '18 at 23:40
  • Why is this not a duplicate of [Extracting Information from json string and add it to a list in C#](https://stackoverflow.com/q/51489048/3744182)? Do you not know how to filter out the `"201322052"` and `"Doctor 201322052"` properties whose values are inconsistent with the schema? – dbc Aug 05 '18 at 01:04
  • @Nkoshi, what is the code format to get the desired key? – Saikat halder Aug 05 '18 at 01:15

1 Answers1

0

Sorry for bothering, all I needed to do is

JObject jobject = JObject.Parse(jsonString); JObject user = (JObject)jobject["JrPwbApfIHbQhCUmVIoiVJcPYv93"];

user.toString() gives the following data

{     "Sat Aug 04 04:02:47":{  
  "Misc":"sdasd",
  "Product":"asd",
  "address":"sd",
  "name":"Dr. Bua"},"Sat Aug 04 04:03:21":{  
  "Misc":"sdasd",
  "Product":"asd",
  "address":"sd",
  "name":"Dr. Bua",
"Sat Aug 04 04:03:28":{  
  "Misc":"sdasd",
  "Product":"asd",
  "address":"sd",
  "name":"Dr. Bua"},
"Sat Aug 04 04:03:31":{  
  "Misc":"sdasd",
  "Product":"asd",
  "address":"sd",
  "name":"Dr. Bua"}}

which I actually needed. Then I extracted the information separately by this help previously provided. Thank you everyone for your response.

Saikat halder
  • 548
  • 4
  • 11