Skip to content

Error reading JSON data source #366

@afr751116

Description

@afr751116

Hello, I have a reference
https://www.fast-report.com/en/blog/show/connecting-JSON-database/
《How to create the connection to JSON database from the application code》
However, there is an error in the actual operation and the data source cannot be registered. Is there a more detailed example?
Code:

` WebReport entity = new WebReport();
Report report = new Report();

        report.Load("wwwroot/FastReport/" + reportName + ".frx"); 
        RegisteredObjects.AddConnection(typeof(JsonDataConnection));
        JsonDataConnection conn = new JsonDataConnection();
        conn.ConnectionString = $"Json={itemPath}.json";
        conn.CreateAllTables();
        report.RegisterData(conn.DataSet);
        report.Dictionary.Connections.Add(conn);
      
        report.Prepare();
        entity.Report = report;

        entity.Mode = WebReportMode.Designer; 
        entity.DesignerLocale = "zh"; 
        entity.DesignerPath = "index.html"; 
        entity.DesignerSaveCallBack = "SaveDesignedReport"; 
        entity.Debug = true;
        entity.Width = "100%";
        entity.Height = "100%";`

image
Json:
{"Id":"1101","Department":"13.10","Name":"张三","MobileOne":"11111111111","MobileTwo":"11111111111","Phone":"11111111111","Email":"11111111111@qq.com","PositionType":"1101","Birthday":"2021-08-01T10:18:25.557","SexType":0,"Address":null,"IdentityCard":null,"EntryTime":"2021-08-02T10:18:30.417","IDCard":"67564333","IsJobType":1}
image

In the end < dictionary / > there is no data. What went wrong?
image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions