Questions tagged [pretty-print]

Prettyprint (or pretty-print) is the application of any of various stylistic formatting conventions to text, source code, markup, and other similar kinds of content. These formatting conventions usually consist of changes in positioning, spacing, color, contrast, size and similar modifications intended to make the content easier for people to view, read and understand.

Filter by
Sorted by
Tagged with
3421votes
59answers
1.5mviews

How can I pretty-print JSON in a shell script?

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... ...
3012votes
28answers
1.4mviews

pretty-print JSON using JavaScript

How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.
user avatar
  • 61.7k
1580votes
14answers
1.7mviews

How to prettyprint a JSON file?

I have a JSON file that is a mess that I want to prettyprint. What's the easiest way to do this in Python? I know PrettyPrint takes an "object", which I think can be a file, but I don't know how to ...
user avatar
  • 20.7k
1267votes
29answers
1.1mviews

Is there a built-in function to print all the current properties and values of an object?

So what I'm looking for here is something like PHP's print_r function. This is so I can debug my scripts by seeing what's the state of the object in question.
user avatar
  • 48k
716votes
19answers
350kviews

How to "pretty" format JSON output in Ruby on Rails

I would like my JSON output in Ruby on Rails to be "pretty" or nicely formatted. Right now, I call to_json and my JSON is all on one line. At times this can be difficult to see if there is a ...
user avatar
711votes
26answers
699kviews

Pretty-Printing JSON with PHP

I'm building a PHP script that feeds JSON data to another script. My script builds data into a large associative array, and then outputs the data using json_encode. Here is an example script: $data = ...
user avatar
  • 19.7k
515votes
13answers
174kviews

How to turn off the Eclipse code formatter for certain sections of Java code?

I've got some Java code with SQL statements written as Java strings (please no OR/M flamewars, the embedded SQL is what it is - not my decision). I've broken the SQL statements semantically into ...
user avatar
  • 31.6k
491votes
27answers
462kviews

Pretty printing XML in Python

What is the best way (or are the various ways) to pretty print XML in Python?
user avatar
  • 13.1k
482votes
34answers
513kviews

How to pretty print XML from Java?

I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this? String unformattedXml = "<tag><...
user avatar
  • 50.5k
467votes
1answer
312kviews

Javascript: How to generate formatted easy-to-read JSON straight from an object? [duplicate]

Possible Duplicate: How can I beautify JSON programmatically? I know how to generate JSON from an object using JSON.stringify, or in my case the handy jquery-json from google code (https://github....
user avatar
419votes
1answer
236kviews

How can I beautify JSON programmatically? [duplicate]

Do you know of any "JSON Beautifier" for JavaScript? From {"name":"Steve","surname":"Jobs","company":"Apple"} To { "name&...
user avatar
  • 7,577
407votes
14answers
514kviews

How to pretty-print a numpy.array without scientific notation and with given precision?

I'm curious, whether there is any way to print formatted numpy.arrays, e.g., in a way similar to this: x = 1.23456 print '%.3f' % x If I want to print the numpy.array of floats, it prints several ...
user avatar
  • 4,085
397votes
0answers
49kviews

Pretty-print C++ STL containers [duplicate]

I would like to have a single template that once and for all takes care of pretty-printing all STL containers via operator<<. In pseudo code, I'm looking for something like this: template<...
user avatar
  • 444k
273votes
13answers
227kviews

How can I pretty-print JSON using Go?

Does anyone know of a simple way to pretty-print JSON output in Go? The stock http://golang.org/pkg/encoding/json/ package does not seem to include functionality for this (EDIT: it does, see accepted ...
user avatar
  • 9,694
263votes
20answers
317kviews

Pretty-Print JSON in Java

I'm using json-simple and I need to pretty-print JSON data (make it more human readable). I haven't been able to find this functionality within that library. How is this commonly achieved?
user avatar
  • 6,117

15 30 50 per page
1
2 3 4 5
67