defmodule JsonTest do
def get_json(filename) do
with {:ok, body} <- File.read(filename),
{:ok, json} <- Poison.decode(body), do: {:ok, json}
end
end
x = JsonTest.get_json("data.json")
JSONValue x = "data.json".readText.parseJSON;
struct User {
int age;
string name;
this(JSONValue user) {
age = user["age"];
name = user["name"];
}
}
auto user = User(x);
defmodule JsonTest do
def get_json(filename) do
with {:ok, body} <- File.read(filename),
{:ok, json} <- Poison.decode(body), do: {:ok, json}
end
end
x = JsonTest.get_json("data.json")
JSONValue x = "data.json".readText.parseJSON;
struct User {
int age;
string name;
this(JSONValue user) {
age = user["age"];
name = user["name"];
}
}
auto user = User(x);