I
I
iamdivine2021-06-25 19:36:26
C++ / C#
iamdivine, 2021-06-25 19:36:26

What is wrong with JSON Deserialization?

Good evening, when deserializing a json file

{
  "nick": "Test_Name",
  "money": 666,
  "lvl": 22,
}

through
var text = File.ReadAllText([email protected]"{path}\accs\Test_Name.json");
                    var result = JsonSerializer.Deserialize<AFormat>(text);
                    MessageBox.Show(result.nick);

The file is read normally, 60d605888c0d1946822677.png60d605918ab18853184967.png
And then an exception is thrown.
{"The JSON value could not be converted to Project.Json.AFormat. Path: $ | LineNumber: 0 | BytePositionInLine: 1."}
Trying to output after deserializing nick.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2021-06-26
@HemulGM

remove the comma
60d74d3618d5b849559493.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question