Need Help: Reading from Json an inserting to collection
See original GitHub issueHi, Im getting the following error while trying to read from json and inserting into Db below is code:
openLoadDef.FileName = "";
openLoadDef.ShowDialog();
string errordef = openLoadDef.FileName;
List<BsonDocument> docs = new List<BsonDocument>();
StreamReader r = new StreamReader(errordef);
var json = r.ReadToEnd();
var jsonObj = JsonSerializer.Deserialize(json);
docs = BsonMapper.Global.ToDocument(jsonObj);
using (var db = new LiteDatabase("ErrorMsg.db"))
{
db.GetCollection("ErrorMsg").InsertBulk(docs);
}
I’m getting the error at BsonMapper Cannot implicitly convert type ‘LiteDB.BsonDocument’ to System.Collections.Generic.List<LiteDB.BsonDocument>’
Can you please advise whats needs to be changed. Input is a plain json file.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to create collections dynamically and insert json file's ...
I have been looking on how to create collections dynamically such that each collection say a_col has a.json data inserted, b_col has b.json...
Read more >How to Read JSON Data and Insert It Into a Database
From within the Project Designer page, expand the Data Translation folder in the Component Library, and then drag the Read JSON task to...
Read more >Import JSON data into SQL Server
This article explores the process of JSON data import in SQL Server table using T-SQL and SSIS.
Read more >How to read a .json file and insert the data into a SharePoint list?
Solved: Hello I want to create a flow that reads a .json file and inserts the data into a SharePoint list. Each data...
Read more >JSON to MongoDB Python: Operations Simplified 101 - Learn
In this article, you will learn about how to insert data from JSON to MongoDB Python. Also, learn to perform operations and import...
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 FreeTop 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
Top GitHub Comments
Hi! With the objective of organizing our issues, we are closing old unsolved issues. Please check the latest version of LiteDB and open a new issue if your problem/question/suggestion still applies. Thanks!