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.

4
  • 2
    Why didn't accept the answer provided to the question you liked to? Commented Aug 4, 2018 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. Commented Aug 4, 2018 at 23:40
  • Why is this not a duplicate of Extracting Information from json string and add it to a list in C#? Do you not know how to filter out the "201322052" and "Doctor 201322052" properties whose values are inconsistent with the schema? Commented Aug 5, 2018 at 1:04
  • @Nkoshi, what is the code format to get the desired key? Commented Aug 5, 2018 at 1:15

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.