peterszerzo/elm-json-tree-view - version: 1.0.0

for more information visit the package's GitHub page

Package contains the following modules:

!! This is a fork of microsoft/elm-json-tree-view, created because the change of the org name from Microsoft to microsoft was breaking Elm project builds. * https://github.com/microsoft/elm-json-tree-view/issues/7 !!

Elm JSON Tree View

This library provides a JSON tree view. You feed it JSON, and it transforms it into interactive HTML.

Try the online demo (source)

Features:

Usage

See the docs or look at the example app's source code.

But if you really insist on something super simple, here goes:

import JsonTree
import Html exposing (text)

main =
    JsonTree.parseString """[1,2,3]"""
        |> Result.map (\tree -> JsonTree.view tree config JsonTree.defaultState)
        |> Result.withDefault (text "Failed to parse JSON")

config = { onSelect = Nothing, toMsg = always () }

Note that the above example is only meant to give you a taste. It does not wire everything up, which means that some things will be broken (i.e. expand/collapse). See the docs and the example app for more details.

Thanks

UI based on Gildas Lormeau's JSONView Chrome extension.