Note that there are some explanatory texts on larger screens.

plurals
  1. POReading dynamic attributes of json into .net C#
    primarykey
    data
    text
    <p>I am getting following json format after hitting to an API: </p> <pre><code>{ "7407": { "survey_id": "406", "device_id": "1", "response_time": "2013-10-10 16:14:01", "timezone": "0", "language_id": "en", "response_id": "7407", "device_alias": "QR Code App", "site_name": "QR Code App", "country_name": "United States", "state_name": "New York", "city_name": "Suffern", "zip": "", "voucher_name": null, "voucher_mode": null, "surveyee_name": null, "surveyee_email": null, "surveyee_phone": null, "ques": { "": [] } }, "7408": { "survey_id": "406", "device_id": "1", "response_time": "2013-10-10 16:36:56", "timezone": "0", "language_id": "en", "response_id": "7408", "device_alias": "QR Code App", "site_name": "QR Code App", "country_name": "India", "state_name": "Gujarat", "city_name": "Ahmedabad", "zip": "", "voucher_name": null, "voucher_mode": null, "surveyee_name": null, "surveyee_email": null, "surveyee_phone": null, "ques": { "": [] } } } </code></pre> <p>I am using <strong><code>JSON.Net</code></strong> to read the above given json data. </p> <p><strong>To map this data into .Net code, I will need classes in .net, having same properties' name as in json string.</strong> <strong>BUT</strong> there are some attributes in json which can be dynamic ("7407", "7408" etc in my case) i.e. this value can be changed based on what are we passing into parameters. </p> <p>My question is, how can we map json attributes (which are dynamic in nature and can have any value depending upon the parameters provided to the apis) to our .net class ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload