JsonDataSource: Parent Columns and Child Columns don't have matching column types

I’m trying to create JsonDataSource to use in the Report engine, but getting an exception:

java.lang.IllegalStateException: Parent Columns and Child Columns don’t have matching column types

Here is the JSON:

{
  "POLICY": {
    "POLICY_ID": "abcd",
    "_PRODUCT_ID": "oiuy",
    "_LAST_MODIFIED_DATE": "2021-05-18T11:29:00.196Z",
    "_BILLING_ADDRESS": {
      "_COUNTRY_CODE": "DEU"
    }
  }
}

here is the code:

String location = "test2.json";
JsonDataLoadOptions options = new JsonDataLoadOptions();
options.setSimpleValueParseMode(JsonSimpleValueParseMode.STRICT);
JsonDataSource jsonDataSource = new JsonDataSource(location, options);

@artyomsv2

We have tested the scenario and managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2588. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

More input test data:

The same JSON, just if “POLICY_ID” property also starts with an underscore, then the creation of the JsonDataSource is successful:

{
  "POLICY": {
    "_POLICY_ID": "abcd",
    "_PRODUCT_ID": "oiuy",
    "_LAST_MODIFIED_DATE": "2021-05-18T11:29:00.196Z",
    "_BILLING_ADDRESS": {
      "_COUNTRY_CODE": "DEU"
    }
  }
}

So, basically the failure pattern is:

"ROOT_PROPERTY_NAME": {
    "ROOT_PROPERTY_NAME_ID": {}
}

@artyomsv2

Thanks for sharing the detail. We have logged this detail in our issue tracking system.

The issues you have found earlier (filed as WORDSJAVA-2588) have been fixed in this Aspose.Words for .NET 21.8 update and this Aspose.Words for Java 21.8 update.

1 Like