# \[ANN\] PrettyPrinting.jl

**URL:** https://discourse.julialang.org/t/ann-prettyprinting-jl/21109
**Category:** Package Announcements
**Tags:** announcement
**Created:** [February 23, 2019, 1:39pm UTC](https://discourse.julialang.org/t/ann-prettyprinting-jl/21109 "2019-02-23T13:39:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![xitology](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xitology/32/7570_2.png) [@xitology](https://discourse.julialang.org/u/xitology)
#### Post date: [February 23, 2019, 1:39pm UTC](https://discourse.julialang.org/t/ann-prettyprinting-jl/21109/1 "2019-02-23T13:39:22Z")

</div>

I’d like to introduce **[PrettyPrinting.jl](https://github.com/rbt-lang/PrettyPrinting.jl)**, a Julia library for optimal formatting of composite data structures on a fixed-width terminal.

PrettyPrinting exports a function `pprint()`, which can display any data assembled from tuples, vectors and dictionaries. For example:

```julia
julia> data = [(name = "POLICE",
                employees = [(name = "JEFFERY A", position = "SERGEANT", salary = 101442, rate = missing),
                             (name = "NANCY A", position = "POLICE OFFICER", salary = 80016, rate = missing)]),
               (name = "OEMC",
                employees = [(name = "LAKENYA A", position = "CROSSING GUARD", salary = missing, rate = 17.68),
                             (name = "DORIS A", position = "CROSSING GUARD", salary = missing, rate = 19.38)])]
2-element Array{NamedTuple{(:name, :employees),T} where T<:Tuple,1}:
 (name = "POLICE", employees = NamedTuple{(:name, :position, :salary, :rate),Tuple{String,String,Int64,Missing}}[(name = "JEFFERY A", position = "SERGEANT", salary = 10
 (name = "OEMC", employees = NamedTuple{(:name, :position, :salary, :rate),Tuple{String,String,Missing,Float64}}[(name = "LAKENYA A", position = "CROSSING GUARD", salar

julia> using PrettyPrinting

julia> pprint(data)
[(name = "POLICE",
  employees = [(name = "JEFFERY A",
                position = "SERGEANT",
                salary = 101442,
                rate = missing),
               (name = "NANCY A",
                position = "POLICE OFFICER",
                salary = 80016,
                rate = missing)]),
 (name = "OEMC",
  employees = [(name = "LAKENYA A",
                position = "CROSSING GUARD",
                salary = missing,
                rate = 17.68),
               (name = "DORIS A",
                position = "CROSSING GUARD",
                salary = missing,
                rate = 19.38)])]

```

---

<div class="post-metadata">

### Author: ![Diego\_Javier\_Zea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diego_javier_zea/32/1858_2.png) [@Diego\_Javier\_Zea](https://discourse.julialang.org/u/Diego_Javier_Zea)
#### Post date: [February 23, 2019, 2:05pm UTC](https://discourse.julialang.org/t/ann-prettyprinting-jl/21109/2 "2019-02-23T14:05:06Z")

</div>

Nice! Do you think that this could be easily integrated in DocumentFormat.jl to deal with long lines? ( [Split lines exceeding width limit · Issue #7 · julia-vscode/DocumentFormat.jl · GitHub](https://github.com/ZacLN/DocumentFormat.jl/issues/7) )

---

<div class="post-metadata">

### Author: ![xitology](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xitology/32/7570_2.png) [@xitology](https://discourse.julialang.org/u/xitology)
#### Post date: [February 23, 2019, 2:15pm UTC](https://discourse.julialang.org/t/ann-prettyprinting-jl/21109/3 "2019-02-23T14:15:00Z")

</div>

@Diego_Javier_Zea, indeed, it should be possible to reuse the layout engine to format Julia code.
