Closed jigneshkvp closed 6 years ago
Sure, let me look into it and get back to you.
Thanks,
I do have a custom serialization option for primitive types. The best I can do is extend to support any type then you can implement your custom logic.
After looking much at it. It will be difficult to support custom deserialization since I read forward only and I don't read a full graph before deserialization. The only way to have it is if you are ok with having to implement a class that we get a stream of data such as {, [, Key and Value then you can handle the rest of it yourself in your custom code.
Is the option above viable? If it is then I can expose a structure to hook into the deserialization step .
Thanks for your input!
I can certainly look into that option. However, it would be also great if you could send me a small example around it.
Even, if I could do something like this, then it would be great:
JObject o = JObject.Parse(@"{
'CPU': 'Intel',
'Drives': [
'DVD read/writer',
'500 gigabyte hard drive'
]
}");
string cpu = (string)o["CPU"];
// Intel
string firstDrive = (string)o["Drives"][0];
// DVD read/writer
IList<string> allDrives = o["Drives"].Select(t => (string)t).ToList();
Probably in the future, we may have support for custom deserialization.
You can already deserialize to dictionary (string, object) and that will give you same result. Just call the deserializeObject method.
Thanks,
Have you tried to use the dictionary option I suggested?
Hello @rpgmaker, I was unable to work with it due to the other obligations. I kept my old implementation for now but will work with your suggestion somewhere next week
I am going to close this issue for now assuming my suggestion works. If not you can reopen it.
Thanks,
Hello,
I am unable to deserialize the following json string to the mentioned class:
The class looks like this:
When I perform, var response = NetJSON.NetJSON.Deserialize(jsonString);
I get the output as a heirarchy object with properties "dict": somenumber, "Value" : null
I was earlier using Newtonsoft.Json and there it has a JConverter class which I extended to deserialize the legacy json array dictionary (which is the output of a wcf service method using DataContractJsonSerializer class).
I am in aww with NetJSON performance (respect!) and I want to use it for deseriliazing the legacy array dicitionary string.
Could you please help in resolving this issue.