- Dec 2, 2007On Sunday 02 December 2007 18:39, Ask Bjørn Hansen wrote:
> On Nov 30, 2007, at 10:50 AM, Randall R Schulz wrote:Perl's not my thing.
> > Compact JSON, as most web apps produce it, is very hard to read.
> > Does anyone here know of a reformatter / pretty-printer for JSON?
> > I'd prefer a command-line tool that runs on (or can be compiled
> > for) Linux.
> > If necessary, I'd use an on-line tool.
> As someone else said, a few words of Perl:
> perl -MJSON -e '$j=JSON->new(pretty=>1); $/=undef; print $j-
> You can either pipe in "ugly" JSON on stdin or specify a file as a
> parameter at the end. Stdout will have the pretty JSON.
I took your command and used the URL that freyfogle gave to get JSON.pm
(and JSON/Parser.pm, which it refers to and without which it will not
run) and I when I invoke it (the command above) I get a pile (246 lines)
of diagnostics. Here are the first few:
Bareword found where operator expected at JSON/Parser.pm line 4, near ""stylesheet" href"
(Missing operator before href?)
Bareword found where operator expected at JSON/Parser.pm line 4, near ""/s/style.css" type"
(Missing operator before type?)
Bareword found where operator expected at JSON/Parser.pm line 7, near "</head"
(Might be a runaway multi-line // string starting on line 6)
(Missing operator before head?)
What's the right way to use this stuff? I'm running on Linux (SuSE Linux 10.0)
> - askThanks.
- << Previous post in topic Next post in topic >>