Is there any way to convert a JSON object into a Custom object without using serialization in .NET core 1.0 . As I'm using .net framework 4.5 built dll and the models which are defined in it are with [Serialize] attribute over it. So when i try to convert the JSON string into object, I'm facing the below error:
Could not load file or assembly 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
The dll internally is referring to the Serialization class in it. Code snippet which I'm using to convert to object
public void ConvertToObject(string jsonString)
{
return JsonConvert.DeserializeObject<CustomObject>(json);
//This line throws error
}
I believe that the problem is only because of the [Serialize] attribute, but we do not have the control to modify the provided dll. And also we just need to stick with NET Core 1.0. I have tried it in Core 2.0 and its working.
[Serialize]is referenced, then you can't use that code if you want to stick with .NET Core 1.