Skip to content

Fixes a problem with Empty arrays using JSON datasources #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

figloalds
Copy link

@figloalds figloalds commented Feb 20, 2025

Previously if you had a an array of complex objects including arrays inside them, you would get a NullReferenceException if the incoming data could have any of those internal arrays be empty. With the added check, the program will correctly understand the lack of value in that property path

Eg:

[
  {
    "items": [{ 
        "productId": 12, "description": "A product of all time" 
    }],
    "payments": [{ "paymentMethodId": 8, "paymentMethodName": "Credit Card", "value": 123.0 }],
    "status": "completed"
  },
  {
    "items": [{ 
        "productId": 6, "description": "Something Really Fancy"
    }]
    "payments": [],
    "status": "cancelled"
  }
]

in the model above, if you were to use a path like sales.payments.value as a totalizer, the data above would cause a NullReferenceException due to payments being an empty array, instead of the expected behavior, with the correction we get the expected result of 123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant