go-edn / edn

Go implementation of EDN (Extensible Data Notation)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty print edn when marshalling

opened this issue · comments

Is it possible to marshal edn data into nicely formatted string? Currently MarshelIndent produces this:

{
  :deps {
    io.netty/netty-buffer {
      :mvn/version "4.1.30.Final"
    },
    potemkin {
      :mvn/version "0.4.5"
    }
  }
}

when I want this:

{:deps    {potemkin              {:mvn/version "0.4.5"}
           io.netty/netty-buffer {:mvn/version "4.1.30.Final"}}}

@fctorial: Hi! Sorry for being slow to reply here: It's possible to use MarshalPPrint or PPrint to get a similar, but not quite identical result. For your input, PPrint would generate

{:deps {io.netty/netty-buffer {:mvn/version "4.1.30.Final"},
        potemkin {:mvn/version "0.4.5"}}}

or potemkin before io.netty, depending on how you input the data.

See https://play.golang.org/p/8FWtHZgWf39 for code