Unable to deserialize JsonProvider types
See original GitHub issueHi, thank you for your library.
I successfully serialized the type generated by the JsonProvider type provider, but when I try to deserialize I get an exception:
Could not create an instance of type FSharp.Data.Runtime.BaseTypes.IJsonDocument. Type is an interface or abstract class and cannot be instantiated. Path ‘folders[0].JsonValue’, line 1, position 25.
use db = new LiteDatabase("wunderlist.db", FSharpBsonMapper())
type F = JsonProvider<"FoldersJsonSample.json", RootName = "Folder">
let folders = F.Load(....)
{ folders = folders } |> db.GetCollection<BackUp>().Insert |> ignore
let get = db.GetCollection<BackUp>().FindAll() // <- exception
would you be able to suggest a workaround or fix it?
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Unable to deserialize json file
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or...
Read more >Unable To Deserialize Object - Forums - Liferay
Locally on my own enviroment i've been able to serialize and deserialize data. To achieve this i used the JSONFactoryUtil.serialize & deserialize methods....
Read more >Failed to deserialize JSON
The error is correct, the built-in JSON deserializer does not allow you to turn an array of simple types into an Object. You...
Read more >JAX-RS Data Bindings - Apache CXF
The "convertTypesToStrings" property can be used to configure JSONProvider to convert all the types to strings. Jackson. If you prefer working with Jackson...
Read more >Jackson JSON Java Parser API Example Tutorial
Jackson JSON Parser API provides easy way to convert JSON to POJO Object and supports easy conversion to Map from JSON data.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Here it is:
from https://github.com/UnoSD/WunderlistBackup
and deserializing is easy…
JsonValue.Parse(bson.ToString())although you may have to add some converters for types like long that get serialized as objects.@UnoSD I am glad you could figure it out, maybe you could share it for others who come across this issue 😃