json_canvas

Package Version Hex Docs

JSON Canvas library for Gleam

Installation

gleam add json_canvas

Usage

import gleam/int
import gleam/io
import gleam/list
import json_canvas
import simplifile

pub fn main() {
  let assert Ok(content) = simplifile.read("input.canvas")
  let assert Ok(canvas) = json_canvas.decode(content)

  let nodes = canvas.nodes
  let edges = canvas.edges

  io.println("Nodes count: " <> int.to_string(list.length(nodes)))
  io.println("Edges count: " <> int.to_string(list.length(edges)))
}

Further documentation can be found at https://hexdocs.pm/json_canvas.

Development

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell
Search Document