• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Deserialize Complex/Branched JSON and accessing branches

Resolved: Deserialize Complex/Branched JSON and accessing branches

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a JSON response which i generated a model from. the JSON data has various branches with data as shown below.
}
I have various branches in this JSON response which i need to use. i generated a model class from this JSON as shown below
Afterwards i used the C# code to deserialize the JSON as shown below
This works fine, however, i am stuck with just customer Data. I want to be able to get the Transactional details (Customer2) and Lastpayment branches in a collection view. how can i achieve this? Thanks

Answer:

You can parse your json and read it by linq. ToObject method help you to convert nodes to specific class. I have taken json text in InputJson variable and then paresed it.
And if you need just some of properties you can use in this way
If you have different nodes in your object , you can call nodes and check them not be null!

If you have better answer, please add a comment about this, thank you!

asp.net-core asp.net-web-api c#
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Vaadin 14.9 – Redirect on Session Destroy Event

26/03/2023

Resolved: How to separate multiple answers in one column, for multiple columns, by creating extra columns

26/03/2023

Resolved: How to set consistent decimal separators in R data frame?

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.