Microsoft/elm-json-tree-view/2.0.0

NOTE: the latest version is 2.0.1

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/microsoft/elm-json-tree-view.

What we checked: The repo moved to github.com/microsoft/elm-json-tree-view. Rebuilt with git archive from commit 95c10e27b036 of https://github.com/microsoft/elm-json-tree-view (zip prefix Microsoft-elm-json-tree-view-95c10e2/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 6e84a645c3c871ea742506eb1c9352c2a1b04b18.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/Microsoft/elm-json-tree-view/zipball/2.0.0/

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:

  • show JSON as a tree of HTML
  • expand/collapse nodes in the tree
  • expand/collapse the entire tree
  • select scalar values in the tree

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.