Skip to content

fix: resolve property name conflicts in StructRow.toJSON()[#95]#344

Open
Divyanshu-s13 wants to merge 2 commits intoapache:mainfrom
Divyanshu-s13:fix-struct-row-tojson-property-conflict
Open

fix: resolve property name conflicts in StructRow.toJSON()[#95]#344
Divyanshu-s13 wants to merge 2 commits intoapache:mainfrom
Divyanshu-s13:fix-struct-row-tojson-property-conflict

Conversation

@Divyanshu-s13
Copy link
Contributor

What's Changed

Fixed a bug in StructRow.toJSON() where field names that match built-in JavaScript object properties (like size, length, toString, etc.) would incorrectly return the built-in property value instead of the actual column data.

The Problem

When a struct had a column named size and you called row.toJSON(), it would return the built-in size property of the object instead of the value from the size column.

The Solution

Modified the toJSON() method in src/row/struct.ts to store the field name in a local variable before using it to access the JSON object. This prevents property name conflicts with built-in object properties.

Closes #95

@kou
Copy link
Member

kou commented Nov 27, 2025

Could you add a test for this?

@Divyanshu-s13
Copy link
Contributor Author

@kou I fixed this issue. Could you please merge it?

@Divyanshu-s13
Copy link
Contributor Author

@kou By the way, I’m planning to apply for GSoC this year and really enjoying contributing here.
I’d love to align my work with areas that matter most to the project.

@kou
Copy link
Member

kou commented Feb 2, 2026

Could you add a test for this?

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.

[js] Incorrect value returned for columns named "size"

2 participants