Skip to content

JSONArrAppend not working as expected in latest release . #2854

@f1forhelp

Description

@f1forhelp

Hello! I recently started using go-redis version v9.3.1, mainly because it offers support for RedisJSON. However, I encountered an issue while attempting to add an element to an array within a JSON object. The error message I received is "expected value at line 1 column 1."

Here's the JSON object I'm working with:

{
    "moves": [
        "m1",
        "m2"
    ],
    "match_status": 2
}

To insert a value into the "moves" array, I'm utilizing the following function:
db.RedisClientWebSocket.JSONArrAppend(context.Background(), fmt.Sprint("match:", redisMatch.Id.Hex()), "$.moves","m3")

Though I can insert struct after marshaling it. But I can't do the same with string.

My development environment is on go version go1.21.4 for darwin/arm64.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions