JsonConvert::DeserializeObject c++ cli 错误
JsonConvert::DeserializeObject erro c++ cli
我正在尝试打开一个文件。json 已经将它发送到 Class。
但是我在做的时候出错了。
ref class CutAnnotationJSon
{
public:
int index;
String^ nomeTipo;
double pontoX1;
double pontoY1;
double pontoX2;
double pontoY2;
double height;
int r;
int g;
int b;
int numberCut;
};
ref class PanoramicAnnotationJSon
{
public:
int index;
String^ nomeTipo;
double pontoX1;
double pontoY1;
double pontoX2;
double pontoY2;
int r;
int g;
int b;
};
ref class DadosJSon
{
public:
List<PanoramicAnnotationJSon^>^ panoramicAnnotation = gcnew List<PanoramicAnnotationJSon^>;
List<CutAnnotationJSon^>^ cutAnnotation = gcnew List<CutAnnotationJSon^>;
};
使用
DadosJSon^ dadosJSon = JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"));
错误信息:
103 IntelliSense: more than one instance of overloaded function "Newtonsoft::Json::JsonConvert::DeserializeObject" matches the argument list:
function template "T Newtonsoft::Json::JsonConvert::DeserializeObject<T>(System::String ^value)"
function template "T Newtonsoft::Json::JsonConvert::DeserializeObject<T>(System::String ^value, ... cli::array<Newtonsoft::Json::JsonConverter ^, 1> ^converters)"
argument types are: (System::String ^)
我正在使用 Newtonsoft::Json::;
我无法重现问题。但是,您可以通过以下方式显式 select JsonConvert.DeserializeObject(String, JsonSerializerSettings)
重载(它可以满足您的要求):
DadosJSon^ dadosJSon = JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"), (JsonSerializerSettings ^)nullptr);
为设置传递 nullptr
值等同于 JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"))
。
我正在尝试打开一个文件。json 已经将它发送到 Class。 但是我在做的时候出错了。
ref class CutAnnotationJSon
{
public:
int index;
String^ nomeTipo;
double pontoX1;
double pontoY1;
double pontoX2;
double pontoY2;
double height;
int r;
int g;
int b;
int numberCut;
};
ref class PanoramicAnnotationJSon
{
public:
int index;
String^ nomeTipo;
double pontoX1;
double pontoY1;
double pontoX2;
double pontoY2;
int r;
int g;
int b;
};
ref class DadosJSon
{
public:
List<PanoramicAnnotationJSon^>^ panoramicAnnotation = gcnew List<PanoramicAnnotationJSon^>;
List<CutAnnotationJSon^>^ cutAnnotation = gcnew List<CutAnnotationJSon^>;
};
使用
DadosJSon^ dadosJSon = JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"));
错误信息:
103 IntelliSense: more than one instance of overloaded function "Newtonsoft::Json::JsonConvert::DeserializeObject" matches the argument list: function template "T Newtonsoft::Json::JsonConvert::DeserializeObject<T>(System::String ^value)" function template "T Newtonsoft::Json::JsonConvert::DeserializeObject<T>(System::String ^value, ... cli::array<Newtonsoft::Json::JsonConverter ^, 1> ^converters)" argument types are: (System::String ^)
我正在使用 Newtonsoft::Json::;
我无法重现问题。但是,您可以通过以下方式显式 select JsonConvert.DeserializeObject(String, JsonSerializerSettings)
重载(它可以满足您的要求):
DadosJSon^ dadosJSon = JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"), (JsonSerializerSettings ^)nullptr);
为设置传递 nullptr
值等同于 JsonConvert::DeserializeObject<DadosJSon^>(File::ReadAllText("c:/movie.json"))
。