Skip to content

Conversation

@Robulane
Copy link
Contributor

Summary

Fixes a bug where the JSON function with JSONFormat.FlattenValueTables argument was not working correctly when the input value is an IUntypedObject.

Problem

When JSON function received an IUntypedObject representing an array of single-column "Value" objects (like [{Value:1},{Value:2},{Value:3}]), the JSONFormat.FlattenValueTables argument was being ignored. The function would output the full object structure
[{"Value":1},{"Value":2},{"Value":3}] instead of the flattened version [1,2,3].

Root Cause

In JsonFunctionImpl.cs, the Visit(IUntypedObject) method processed arrays without checking the _flattenValueTables flag, unlike the Visit(TableValue) method which correctly handled this flag.

Changes Made

  1. JsonFunctionImpl.cs: Modified IUntypedObject array handling to check for single-column "Value" objects and flatten them when the flag is set
  2. JsonSerializeUOTests.cs: Added comprehensive unit tests covering:
    • Flattening single-column Value arrays
    • Preserving structure without the flag
    • Not flattening multi-column objects
    • Handling null values correctly

Test plan

  • Added new test: JsonSerializeUOWithFlattenValueTablesTest
  • Existing JSON.txt test cases continue to pass
  • Build succeeds with no warnings or errors

@Robulane Robulane requested a review from a team as a code owner January 22, 2026 09:39
anderson-joyle
anderson-joyle previously approved these changes Jan 22, 2026
Copy link
Contributor

@anderson-joyle anderson-joyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@Robulane Robulane force-pushed the users/robulane/FixFlatteningForUntyped branch from 3009b47 to 4ab5811 Compare January 22, 2026 15:54
@Robulane Robulane force-pushed the users/robulane/FixFlatteningForUntyped branch from 4ab5811 to fcb24f1 Compare January 22, 2026 15:58
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.

3 participants