Giter Site home page Giter Site logo

greglearns / elm-json-tree-view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from klazuka/elm-json-tree-view

0.0 0.0 0.0 109 KB

A library for Elm that shows JSON data as an expandable HTML tree

Home Page: http://package.elm-lang.org/packages/klazuka/elm-json-tree-view/latest

License: MIT License

Elm 14.01% HTML 85.99%

elm-json-tree-view's Introduction

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

History

I originally published this as Microsoft/elm-json-tree-view, but in May 2019 Microsoft changed their GitHub organization name which broke elm package. Rather than waiting for a fix in the Elm package repository, I have decided to move all work over to my personal GitHub account and re-publish.

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 (), colors = JsonTree.defaultColors }

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.

elm-json-tree-view's People

Contributors

klazuka avatar pascallemerrerpro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.