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

JGET returns invalid JSON when JSET sends strings that look like numbers #493

Closed
spierepf opened this issue Sep 13, 2019 · 2 comments · Fixed by #501
Closed

JGET returns invalid JSON when JSET sends strings that look like numbers #493

spierepf opened this issue Sep 13, 2019 · 2 comments · Fixed by #501

Comments

@spierepf
Copy link

$ telnet localhost 9851
Trying ::1...
Connected to localhost.
Escape character is '^]'.
JSET user 901 name 0236
+OK
jget user 901
$13
{"name":0236}
JSET user 901 name "0236"
+OK
jget user 901
$13
{"name":0236}

The trouble is that {"name":0236} is not strictly valid JSON and is rejected by the Jackson parser (https://github.com/FasterXML/jackson)

Is there syntax that will force JSET to treat the value as a string?

@tidwall
Copy link
Owner

tidwall commented Sep 21, 2019

Thanks for reporting this. Until this issue is fixed, as a workaround, I recommend using the RAW or STR options. The RAW option puts raw json, as is, into the field. The STR option converts the value to a valid json string, no matter what it is.

JSET user 901 name '"0236"' RAW
JSET user 901 name 0236 STR
``

@spierepf
Copy link
Author

spierepf commented Oct 1, 2019

Sorry, I should have seen that in the docs. Thanks!

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 a pull request may close this issue.

2 participants