Yes, the quotes should be removed.

I'd recommend using the binary IPC format to send data to the browser though.

Deserializing to JSON is expensive, loses the benefits of features like 
dictionary encoding, and reconstructing types on the receiving end is 
error-prone (as illustrated here).

Paul

> On Oct 28, 2020, at 9:31 AM, Sam Peka <sam.i.p...@gmail.com> wrote:
> 
> Hi there,
> 
> The toJSON method of BigNum is currently returning a string with quotation 
> marks around it: 
> https://github.com/apache/arrow/blob/fbb781bcdd15d54c52c71881c5c53d0c68069be6/js/src/util/bn.ts#L39
> 
> JSON.stringify will include those quotation marks in the output JSON. Here’s 
> an example illustrating the issue:
> 
> const a = BN.new([12])
> console.log(JSON.stringify({ a }))
>> {"a":"\"12\""}
> 
> Our usecase is to take some arrow data and return it to a web client as json 
> – but because the format is bad we’re having to work around this by 
> converting all BigNums to strings before serilaizing the response.
> 
> Is BigNum.toJSON intended to work with JSON.stringify? Happy to open a PR if 
> so.
> 
> Best,
> Sam

Reply via email to