Skip to content

json.get sometimes returning a string instead of json #2937

Closed
@CaptainCodeman

Description

@CaptainCodeman

Description

I have two separate projects that have the same issue after upgrading from 4.7.0 to 5.0.0, and downgrading back to 4.7.0 fixes the issue on both.

json.get occasionally returns the result as a single string instead of json, like JSON.parse isn't being used.

Given this code:

await redis.json.set('test', '$', { name: 'CaptainCodeman' })
const data = await redis.json.get('test')
console.log(typeof data, data)

Version 4.7.0 outputs object { name: 'CaptainCodeman' }
Version 5.0.0 outputs string {"name":"CaptainCodeman"}

Strangely, it doesn't seem to be consistent - some data / keys work as expected and others don't, some work and then stop working at a certain point in the code, it's very odd.

The data in redis itself is always identical and is JSON:

Image

Node.js Version

v22.11.0

Redis Server Version

7.4.2

Node Redis Version

5.0.0

Platform

macOS

Logs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions