How can I debug the assignment of an object to a class?

Alan2

I am trying to assign this object as follows:

RootObject aaa = new RootObject() {
  "word": "example",
  "results": [
    {
      "definition": "a representative form or pattern",
      "partOfSpeech": "noun",
      "synonyms": [
        "model"
      ],
      "typeOf": [
        "representation",
        "internal representation",
        "mental representation"
      ],
      "hasTypes": [
        "prefiguration",
        "archetype",
        "epitome",
        "guide",
        "holotype",
        "image",
        "loadstar",
        "lodestar",
        "microcosm",
        "original",
        "paradigm",
        "pilot",
        "prototype",
        "template",
        "templet",
        "type specimen"
      ],
      "derivation": [
        "exemplify"
      ],
      "examples": [
        "I profited from his example"
      ]
    },
    {
      "definition": "something to be imitated",
      "partOfSpeech": "noun",
      "synonyms": [
        "exemplar",
        "good example",
        "model"
      ],
      "typeOf": [
        "ideal"
      ],
      "hasTypes": [
        "pacemaker",
        "pattern",
        "beauty",
        "prodigy",
        "beaut",
        "pacesetter"
      ],
      "derivation": [
        "exemplify",
        "exemplary"
      ]
},
    {
      "definition": "an occurrence of something",
      "partOfSpeech": "noun",
      "synonyms": [
        "case",
        "instance"
      ],
      "typeOf": [
        "happening",
        "natural event",
        "occurrence",
        "occurrent"
      ],
      "hasTypes": [
        "clip",
        "mortification",
        "piece",
        "time",
        "humiliation",
        "bit"
      ],
      "derivation": [
        "exemplify"
      ],
      "examples": [
        "but there is always the famous example of the Smiths"
      ]
    },
    {
      "definition": "an item of information that is typical of a class or group",
      "partOfSpeech": "noun",
      "synonyms": [
        "illustration",
        "instance",
        "representative"
      ],
      "typeOf": [
        "information"
      ],
      "hasTypes": [
        "excuse",
        "apology",
        "specimen",
        "case in point",
        "sample",
        "exception",
        "quintessence",
        "precedent"
      ],
      "derivation": [
        "exemplify",
        "exemplary"
      ],
      "examples": [
        "this patient provides a typical example of the syndrome",
        "there is an example on page 10"
      ]
    },
    {
      "definition": "punishment intended as a warning to others",
      "partOfSpeech": "noun",
      "synonyms": [
        "deterrent example",
        "lesson",
        "object lesson"
      ],
      "typeOf": [
        "monition",
        "admonition",
        "word of advice",
        "warning"
      ],
      "derivation": [
        "exemplary"
      ],
      "examples": [
        "they decided to make an example of him"
      ]
    },
    {
      "definition": "a task performed or problem solved in order to develop skill or understanding",
      "partOfSpeech": "noun",
      "synonyms": [
        "exercise"
      ],
      "typeOf": [
        "lesson"
      ],
      "examples": [
        "you must work the examples at the end of each chapter in the textbook"
      ]
    }
  ],
  "syllables": {
    "count": 3,
    "list": [
      "ex",
      "am",
      "ple"
    ]
  },
  "pronunciation": {
    "all": "ɪɡ'zæmpəl"
  }
}

Here are the classes I defined:

        public class Result
{
    public string definition { get; set; }
    public string partOfSpeech { get; set; }
    public List<string> synonyms { get; set; }
    public List<string> typeOf { get; set; }
    public List<string> hasTypes { get; set; }
    public List<string> derivation { get; set; }
    public List<string> examples { get; set; }
}

public class Syllables
{
    public int count { get; set; }
    public List<string> list { get; set; }
}

public class Pronunciation
{
    public string all { get; set; }
}

public class RootObject
{
    public string word { get; set; }
    public List<Result> results { get; set; }
    public Syllables syllables { get; set; }
    public Pronunciation pronunciation { get; set; }
}

I'm getting syntax errors starting on the first line with "word".

Is there a way I can debug this or at least find out what is causing the problem?

rudolf_franek

Try

RootObject aaa = JsonConvert.DeserializeObject<RootObject>(
    put_your_string_from_the_question);

Download Json.Net from nuget.org

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I debug a method from a class in Java?

From Dev

How can I determine the class of an object in Scala?

From Dev

How can I check class (not object) inheritance?

From Dev

How can I check class (not object) inheritance?

From Dev

How can I debug this program?

From Dev

how do i debug error: lvalue required as left operand of assignment?

From Dev

How can I debug "Object reference not set to an instance of an object" in VS2013?

From Dev

How can I avoid the void assignment in this code?

From Dev

How can I accelerate the array assignment in python?

From Dev

How can I overload the assignment operation in Rust?

From Dev

How can I decode an object when original class is not available?

From Dev

How can I get a Class object form primitive?

From Dev

How can I initialize a static const object in a class and use it?

From Dev

How can I declare same object name for different class?

From Dev

How can I provide a scala companion object's class to Java?

From Dev

How can I use a third party Class Object as Hashmap Key?

From Dev

How can I get a class from a jQuery datatable row object?

From Dev

How can I get Request object inside a class in Symfony 2?

From Dev

How can I get HttpServletRequest Object in Jodd action class?

From Dev

How can I get the class object from its member variable?

From Dev

How can I check if a object is an instance of a specific class?

From Dev

How can I use a Class object as a parameterized type?

From Dev

How can I get the Object from a Field/Class using reflection?

From Dev

How can i make a class create a PictureBox object inside a form

From Dev

How can I access an object defined in another class?

From Dev

How can I get the caller class object from a method in java?

From Dev

How can I set the class of a span based on the value of an object?

From Dev

How can I check if a class object exists in a C++ set?

From Dev

How can I create object of class whose constructor is defined as private

Related Related

  1. 1

    How can I debug a method from a class in Java?

  2. 2

    How can I determine the class of an object in Scala?

  3. 3

    How can I check class (not object) inheritance?

  4. 4

    How can I check class (not object) inheritance?

  5. 5

    How can I debug this program?

  6. 6

    how do i debug error: lvalue required as left operand of assignment?

  7. 7

    How can I debug "Object reference not set to an instance of an object" in VS2013?

  8. 8

    How can I avoid the void assignment in this code?

  9. 9

    How can I accelerate the array assignment in python?

  10. 10

    How can I overload the assignment operation in Rust?

  11. 11

    How can I decode an object when original class is not available?

  12. 12

    How can I get a Class object form primitive?

  13. 13

    How can I initialize a static const object in a class and use it?

  14. 14

    How can I declare same object name for different class?

  15. 15

    How can I provide a scala companion object's class to Java?

  16. 16

    How can I use a third party Class Object as Hashmap Key?

  17. 17

    How can I get a class from a jQuery datatable row object?

  18. 18

    How can I get Request object inside a class in Symfony 2?

  19. 19

    How can I get HttpServletRequest Object in Jodd action class?

  20. 20

    How can I get the class object from its member variable?

  21. 21

    How can I check if a object is an instance of a specific class?

  22. 22

    How can I use a Class object as a parameterized type?

  23. 23

    How can I get the Object from a Field/Class using reflection?

  24. 24

    How can i make a class create a PictureBox object inside a form

  25. 25

    How can I access an object defined in another class?

  26. 26

    How can I get the caller class object from a method in java?

  27. 27

    How can I set the class of a span based on the value of an object?

  28. 28

    How can I check if a class object exists in a C++ set?

  29. 29

    How can I create object of class whose constructor is defined as private

HotTag

Archive