Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

npm outputs invalid json #1925

Closed
DavidIAm opened this Issue Dec 22, 2011 · 5 comments

Comments

Projects
None yet
4 participants

Json spec:

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes.

When I execute commands like npm view, the output is not dissimilar from json - it might even be javascript - but what it is definitely NOT is JSON.

The output of this command is hence useless for automation. Surely it would not be difficult to use a standard pretty-printer to output this information in legal JSON notation?

DavidIAm commented Jan 3, 2012

"npm info" is the command I was speaking of.

It would be nice if there was a way to interact with npm in a parseable api way. Its nice to not have to reengineer npm's capabilities when they're already implimented so nicely.

I suppose in the end it would end up splitting npm into controller/view sections and having an api view and a CLI view...

The output of npm view is also not really JSON. It ignores the --json option.

+1. I have some use cases where node view|info outputting valid json would make my life much easier.

@isaacs isaacs closed this in 89bd086 Sep 28, 2012

Owner

isaacs commented Sep 28, 2012

info and view are the same command, btw. Will be fixed in 1.1.62.

Owner

isaacs commented Sep 28, 2012

Er, 1.1.63.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment