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

-forcefloats flag does not work #77

Open
sheng-di opened this issue Apr 19, 2020 · 1 comment
Open

-forcefloats flag does not work #77

sheng-di opened this issue Apr 19, 2020 · 1 comment

Comments

@sheng-di
Copy link

sheng-di commented Apr 19, 2020

It does not work.
Input:

echo '{"value": 9.00}' | gojson -forcefloats

and the output is:

type Foo struct {
	Value int64 `json:"value"`
}

The -forcefloats flag does not work.

@sheng-di
Copy link
Author

sheng-di commented Apr 19, 2020

Currently I use the following script to solve this:

before=$(pbpaste | gojson)
after="${before//int64/float64}"
echo "${after}" | pbcopy

It can convert clipboard's json content, and paste it back to clipboard automatically.
It runs well on mac OS.

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