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

hex value exported into json, but json does not support hex literals #1761

Open
Ablu opened this issue Feb 25, 2025 · 0 comments
Open

hex value exported into json, but json does not support hex literals #1761

Ablu opened this issue Feb 25, 2025 · 0 comments

Comments

@Ablu
Copy link

Ablu commented Feb 25, 2025

Taking:

> cat /tmp/i.csv
a,b
foo,0x123

I get:

> mlr --icsv --ojson cat /tmp/i.csv
[
{
  "a": "foo",
  "b": 0x123
}
]

But 0x123 is not a valid JSON value:

> mlr --icsv --ojson cat /tmp/i.csv | jq
jq: parse error: Invalid numeric literal at line 5, column 0

Tested with:

> mlr --version
mlr 6.13.0

One probably wants to either export it as base 10 number or as string:

[
{
  "a": "foo",
  "b": "0x123"
}
]

or:

[
{
  "a": "foo",
  "b": 291
}
]
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

No branches or pull requests

1 participant