This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.1
Pretty print JSON with nesting indents into a String
version 1.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2018-05-10 16:18:46 UTC
the-sett/elm-pretty-printer 1.0.1 <= v < 2.0.0 1.0.1
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

Modules

README

elm-pretty-print-json

Pretty print JSON encoded as a String or as Json.Encode.Value with nesting indents.

Useful for implementing JSON editors, where you want to format the JSON before initializing a <textarea>

Example

Take a string containing JSON and format it with 4 space indents.

json = """{"name": "Arnold", "age": 70, "isStrong": true,"knownWeakness": null,"nicknames": ["Terminator", "The Governator"],"extra": {"foo": "bar","zap": {"cat": 1,"dog": 2},"transport": [[ "ford", "chevy" ],[ "TGV", "bullet train", "steam" ]]}}"""

indent = 4

Result.withDefault "" (Json.Print.prettyString indent json)
{-
{
    "extra": {
        "transport": [
            [
                "ford",
                "chevy"
            ],
            [
                "TGV",
                "bullet train",
                "steam"
            ]
        ],
        "zap": {
            "dog": 2,
            "cat": 1
        },
        "foo": "bar"
    },
    "nicknames": [
        "Terminator",
        "The Governator"
    ],
    "knownWeakness": null,
    "isStrong": true,
    "age": 70,
    "name": "Arnold"
}
-}