I am trying to make api for https://dictionaryapi.dev/ in C#.
Its for a little school project. Im trying to make the JSON into a class, that i can then access.
This is an example of their json output for the given word “hello”:
https://api.dictionaryapi.dev/api/v2/entries/en/hello
Meanwhile, this is my code to deserialize it:
public class Word
{
public string word;
public string phonetic;
public string origin;
public phoneticitem[] phonetics;
public meaning[] meanings;
public sealed class phoneticitem
{
public string text;
public string audio;
public string source;
public license license;
}
public sealed class license
{
public string name;
public string url;
}
public sealed class meaning
{
public string partOfSpeech;
public definitionEntry[] definitions;
}
public sealed class definitionEntry
{
public string definition;
public string[] synonyms;
public string[] antonyms;
public string example;
}
}
Is there something im missing?
Tried making different things public, but to no avail.
Andrew Cavallo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.