0

I want get value like array[0].FNAME

How to get in c# ?

[
  {
    "ID": 4012,
    "FNAME": "MyNAme",
    "MNAME": null,
    "LNAME": "Surname",
    "TITLE": null,
  },
  {
    ....
  }
]
3
  • 1
    Parse it into a concrete data type or into JObject/JToken (Newtonsoft) then access the array element and the property? Commented Jan 27, 2022 at 12:15
  • @huMptyduMpty Ugh; the problem with decade+ old canoncicals is that they might unnecessarily push a user into doing something like we did more than 10 years ago.. The first two answers on that one (if the OP is in Oldest mode) promote the decrepit JavaScriptSerializer. If you dupe-link to something like that, which has a full spread of answers some of which are less desirable in a modern context, you should perhaps consider calling the OP to a particular answer Commented Jan 27, 2022 at 12:30
  • See Haldo's answer in stackoverflow.com/questions/7895105/… - a good bit of advice that can be summarized as: "Take your JSON there and paste it into app.quicktype.io, pick a name and a namespace, and set C# as the target language, then paste the code it generates into your project. Read the comments of the generated code; it will tell you the one line of code you need to use to turn your json string into the c# objects". You code will literally end us as 2 lines: var o = SomeNameYouChose.FromJson(yourJsonStringHere); var fname = o[0].Fname; Commented Jan 27, 2022 at 12:35

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.