StiJsonDatabase creates all columns as String type (No automatic type inference)
Posted: Mon Nov 24, 2025 8:30 am
Hello,
I am using Stimulsoft Reports.Java (version 2025.4.1) and I have encountered an issue regarding JSON data sources.
When I add a StiJsonDatabase programmatically and generate the data sources, the engine creates all columns with StiSystemType.String, regardless of the actual data type in the JSON (Integer, Boolean, etc.).
Here is a simplified version of my code:
The Issue:
After calling createDataSources(), if I inspect the generated columns in the dictionary:
id is created as System.String (Expected: Int32 or Int64)
isActive is created as System.String (Expected: Boolean)
amount is created as System.String (Expected: Decimal or Double)
I have checked StiBaseOptions.getDefaultJsonConverterVersion() and it is using ConverterV2. I also tested with ConverterV1, but the result is the same.
My Current Workaround:
Currently, I have to manually parse the JSON using an external library (Jackson), infer the types myself by analyzing the data, and then loop through the Stimulsoft DataSource columns to manually set column.setSystemType(...).
Question:
Is there a native way, a specific option, or a method in the Java engine to enable automatic type inference for JSON datasources? It seems the .NET version handles this, but the Java version defaults everything to String.
Any suggestions would be appreciated.
Thanks.
I am using Stimulsoft Reports.Java (version 2025.4.1) and I have encountered an issue regarding JSON data sources.
When I add a StiJsonDatabase programmatically and generate the data sources, the engine creates all columns with StiSystemType.String, regardless of the actual data type in the JSON (Integer, Boolean, etc.).
Here is a simplified version of my code:
Code: Select all
StiJsonDatabase jsonDatabase = new StiJsonDatabase();
jsonDatabase.setName("MyDatabase");
jsonDatabase.setJsonData(jsonString); // e.g. [{"id": 100, "isActive": true, "amount": 50.5}]
dictionary.getDatabases().add(jsonDatabase);
// This generates the datasources and columns
jsonDatabase.createDataSources(dictionary);
After calling createDataSources(), if I inspect the generated columns in the dictionary:
id is created as System.String (Expected: Int32 or Int64)
isActive is created as System.String (Expected: Boolean)
amount is created as System.String (Expected: Decimal or Double)
I have checked StiBaseOptions.getDefaultJsonConverterVersion() and it is using ConverterV2. I also tested with ConverterV1, but the result is the same.
My Current Workaround:
Currently, I have to manually parse the JSON using an external library (Jackson), infer the types myself by analyzing the data, and then loop through the Stimulsoft DataSource columns to manually set column.setSystemType(...).
Question:
Is there a native way, a specific option, or a method in the Java engine to enable automatic type inference for JSON datasources? It seems the .NET version handles this, but the Java version defaults everything to String.
Any suggestions would be appreciated.
Thanks.