Standard library
JSON
One method. It takes any, and returns a string that looks like it has a plan.
including "stdlib/json.alana"; then newobj Json().
Json
| Function | What she does | Parameters | Returns |
|---|---|---|---|
Serialize |
Serializes your value as JSON | any value to serialize |
The JSON value as a str |
including "stdlib/json.alana";
define Json json is newobj Json();
define func Serialize(any value) returning str;
return call json.Serialize(value);
end;
define str body is "{
\"name\": \"John Doe\",
\"age\": 30,
\"email\": \"johndoe@example.com\"
}";
define str parsedBody is call Serialize(body);
showln parsedBody;
Handy before Http.Post, which would like a body that is not just vibes.