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

Wrong JSON conversion? #211

Closed
aborruso opened this issue Dec 23, 2018 · 12 comments
Closed

Wrong JSON conversion? #211

aborruso opened this issue Dec 23, 2018 · 12 comments
Labels
go-port Things which will be addressed in the Go port AKA Miller 6

Comments

@aborruso
Copy link
Contributor

aborruso commented Dec 23, 2018

Hi,
if I run

echo "CUP=H64H15000820002,CODICE_LOCALE_PROGETTO=2191E" | mlr --ojson cat

I have

{ "CUP": "H64H15000820002", "CODICE_LOCALE_PROGETTO": 2191E }

But I should have "2191E" with double quotes, because it's a string and not a number. Am I wrong?

Thank you

@johnkerl
Copy link
Owner

I get

$ echo "CUP=H64H15000820002,CODICE_LOCALE_PROGETTO=2191E" | mlr --ojson cat
{ "CUP": "H64H15000820002", "CODICE_LOCALE_PROGETTO": "2191E" }

$ mlr --version
Miller v5.4.0-dev

and

$ echo "CUP=H64H15000820002,CODICE_LOCALE_PROGETTO=2191E" | ./miller-releases/miller-5.4.0/c/mlr --ojson cat
{ "CUP": "H64H15000820002", "CODICE_LOCALE_PROGETTO": "2191E" }

$ ./miller-releases/miller-5.4.0/c/mlr --version
Miller v5.4.0

@aborruso
Copy link
Contributor Author

Hi @johnkerl,
I'm using debian (WSL in Windows10) and Miller v5.4.0-dev, but I have wrong result :(

image

@johnkerl
Copy link
Owner

Weird.

@johnkerl
Copy link
Owner

mlr --ojson --jvquoteall cat is a workaround here ...

@aborruso
Copy link
Contributor Author

hi @johnkerl thank you I know, but in this way I will have also "fieldNumber": "1254" and I would like to have "fieldNumber": 1254

@johnkerl
Copy link
Owner

:(

@johnkerl
Copy link
Owner

Appears to be related to #178

@aborruso
Copy link
Contributor Author

Appears to be related to #178

Ok, but the strange thing is that you have no error, as if the problem depended on the platform in which it was compiled

@aborruso
Copy link
Contributor Author

@johnkerl a note: I have the same wrong result using the last compiled release for Linux https://github.com/johnkerl/miller/releases/download/5.4.0/mlr.linux.x86_64

With windows compiled version (mlr.exe) I have the right result

@aborruso
Copy link
Contributor Author

Hi @johnkerl ,
in these days I'm working on this kind of input

tenders 3345
tenderers 6818
suppliers 3439
tendersZero 226
ID 01199250158

Is there a way to create a correct JSON as

{ "tenders": 3345, "tenderers": 6818, "suppliers": 3439, "tendersZero": 226, "ID": "01199250158" }

and not

{ "tenders": 3345, "tenderers": 6818, "suppliers": 3439, "tendersZero": 226, "ID": 01199250158 }

The last field is a string.

Thank you

@johnkerl
Copy link
Owner

This will be addressed by the Go port.

@johnkerl johnkerl added active and removed wishlist labels Aug 31, 2020
@johnkerl johnkerl added the go-port Things which will be addressed in the Go port AKA Miller 6 label Sep 15, 2020
@johnkerl
Copy link
Owner

Fixed in Miller 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go-port Things which will be addressed in the Go port AKA Miller 6
Projects
None yet
Development

No branches or pull requests

2 participants