Hello PowerApps Experts,
I need help reconstructing a deeply nested JSON structure while preserving its hierarchy in Power Apps. I receive the following JSON:
Sample Data
"TaxYears": [
{
"@valid": "true",
"Year": "2023",
"YearlyRate": "2.50",
"coreGrossWagesDetail": {
"@valid": "true",
"wageRecords": {
"@valid": "true",
"@wageRecordCount": "2",
"wageRecord": [
{
"@valid": "true",
"benefitClaimInd": "N",
"coreQuarterlyWages": {
"@valid": "true",
"qtr1Amount": "5000.00",
"qtr2Amount": "5000.00",
"qtr3Amount": "5000.00",
"ytdAmount": "15000.00"
},
"wagePerson": {
"@valid": "true",
"ssn": "501501501",
"firstName": "John",
"lastName": "Doe"
}
},
{
"@valid": "true",
"benefitClaimInd": "N",
"coreQuarterlyWages": {
"@valid": "true",
"qtr1Amount": "6000.00",
"qtr2Amount": "6000.00",
"qtr3Amount": "6000.00",
"ytdAmount": "18000.00"
},
"wagePerson": {
"@valid": "true",
"ssn": "502502502",
"firstName": "Jane",
"lastName": "Smith"
}
}
]
}
},
"qtr1Balance": "0",
"qtr2Balance": "0",
"qtr3Balance": "0",
"qtr4Balance": "0"
},
{
"@valid": "true",
"Year": "2024",
"YearlyRate": "2.75",
"coreGrossWagesDetail": {
"lidva": "true",
"wageRecords": {
"@valid": "true",
"@wageRecordCount": "1",
"wageRecord": [
{
"@valid": "true",
"benefitClaimInd": "Y",
"coreQuarterlyWages": {
"@valid": "true",
"qtr1Amount": "7000.00",
"qtr2Amount": "7000.00",
"qtr3Amount": "7000.00",
"ytdAmount": "21000.00"
},
"wagePerson": {
"@valid": "true",
"ssn": "503503503",
"firstName": "Alice",
"lastName": "Johnson"
}
}
]
}
},
"qtr1Balance": "0",
"qtr2Balance": "0",
"qtr3Balance": "0",
"qtr4Balance": "0"
}
]
}
- Extract tax years dynamically (2023, 2024, etc.).
- Loop through wage records for each tax year.
- Reconstruct the JSON in the same nested format while storing it in a record variable.
Challenges:
ParseJSON()
creates an untyped object, making it hard to loop through.- Nested
ForAll()
doesn't work correctly for deeply nested objects. - How do I structure
Collections
andVariables
properly?
Current Attempt (Not Working)
I need a structured approach to rebuild the JSON while keeping it formatted like the original.
âś… How can I properly loop through tax years and wage records to reconstruct this JSON?
âś… What is the best way to store this in PowerApps collections or records?
Thanks in advance! 🚀