Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok I got it working, multiple things might have been wrong, here's what I did:</p> <ul> <li>Added public modifier to every field.</li> <li>Removed <code>Safetyreport</code> from JSON</li> <li>Changed all doublequotes(") to quotes (') </li> </ul> <p>Try this:</p> <pre><code>class Program { static void Main(string[] args) { string json = @"{ 'SafetyData': [{ 'Unsafe': 'YES', 'CategoryName': 'Body Mechanics', 'CategoryData': 'Grip / Force', 'Safe': 'NO' }, { 'Unsafe': 'YES', 'CategoryName': 'Position of People', 'CategoryData': 'Falling', 'Safe': 'NO' }, { 'Unsafe': 'YES', 'CategoryName': 'Position of People', 'CategoryData': 'Other', 'Safe': 'YES' }], 'SafeActsObserved': 'APPLE', 'UnsafeActsObserved': 'OK', 'Date': '11 / 11 / 1988', 'ObserverName': 'Bob', 'ObserverGroup': 'TEST', 'LocationAreaRegion': 'Nowhere', 'Email': 'abc@abc.com' } "; SafetyReport sr = JsonConvert.DeserializeObject&lt;SafetyReport&gt;(json); Console.ReadLine(); } } public class SafetyReport { public IList&lt;SafetyData&gt; SafetyData { get; set; } public string SafeActsObserved { get; set; } public string UnsafeActsObserved { get; set; } public string Date { get; set; } public string ObserverName { get; set; } public string ObserverGroup { get; set; } public string LocationAreaRegion { get; set; } public string Email { get; set; } } public class SafetyData { public string Unsafe { get; set; } public string Safe { get; set; } public string CategoryName { get; set; } public string CategoryData { get; set; } } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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