Packages

A bridge between Glamorous Toolkit (GT) and the BEAM VM, enabling remote code evaluation, object inspection, and Phlow view rendering.

Current section

Files

Jump to
gt_bridge lib examples e_serialization.ex
Raw

lib/examples/e_serialization.ex

defmodule Examples.ESerialization do
@moduledoc """
I am examples for the GtBridge serializer.
"""
use ExExample
import ExUnit.Assertions
def rerun?(_), do: true
@spec self_json() :: binary()
example self_json do
assert {:ok, res} = GtBridge.Serializer.to_json(self())
assert {:ok, self()} == GtBridge.Serializer.from_json(res)
res
end
@spec binary_json() :: binary()
example binary_json do
assert {:ok, res} = GtBridge.Serializer.to_json(<<222, 50, 60>>)
assert res == "[\"__base64__\",\"3jI8\"]"
assert {:ok, <<222, 50, 60>>} == GtBridge.Serializer.from_json(res)
res
end
end