Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job data field is doubly serialized #70

jbr opened this issue Nov 19, 2019 · 1 comment


Copy link

@jbr jbr commented Nov 19, 2019

This seems to be the line in question. As a result of this, JSON.parse(JSON.stringify(job)).data is always a string, which was quite surprising. My particular use case is sending a Job over a socket serialized as json. It's easy enough to work around this, but since this is still an early release it seemed worth mentioning that this might surprise others as well.


This comment has been minimized.

Copy link

@manast manast commented Nov 20, 2019

Yes, the problem is that toJSON should be called something different, because it is not really meant to be used by JSON.stringify.

jbr added a commit to jbr/bullmq that referenced this issue Nov 20, 2019
renames Job#toJSON to Job#asJSON and adds a test
manast added a commit that referenced this issue Nov 21, 2019
fix: avoid changing Job property types through JSON serialization/deserialization #70
manast pushed a commit that referenced this issue Nov 21, 2019

### Bug Fixes

* avoid Job<->Queue circular json error ([5752727](5752727))
* avoid the .toJSON serializer interface [#70](#70) ([5941b82](5941b82))
@jbr jbr closed this Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.