Skip to content

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?

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