con un clic
decoding-json
Decode and parse JSON strings with EYG.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Decode and parse JSON strings with EYG.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Work with the DNSimple API to manage domains and integrations.
Create and dispatch HTTP requests.
Work with the GitHub API to manage repositories, issues, and other resources.
When a user makes a location specific query (what is the weather tomorrow) or asks for anything relative to their location.
Manage a running ollama instance; start stop and list active models
Work with the Netlify API to manage sites and deployments.
Basado en la clasificación ocupacional SOC
| name | decoding-json |
| description | Decode and parse JSON strings with EYG. |
EYG is a strongly typed language.
When decoding JSON it MUST also be passed into a useful datastructure.
The @json package is for decoding JSON.
let {parse: parse, decode: decode} = @json
let result = parse("true", decode.boolean)
// Will return Ok(True({}))
let result = parse("3", decode.integer)
// Will return Ok(3)
let result = parse("\"hi\"", decode.string)
// Will return Ok("hi)
EYG does not support parsing floats
let {parse: parse, decode: decode} = @json
let decoder = decode.list(decode.integer)
let result = parse("[1, 2, 3]", decoder)
// Will return Ok([1, 2, 3])
let {parse: parse, decode: decode} = @json
let decoder = decode.object((decoded) -> {
let foo = decode.field("foo", decode.integer, decoded)
{foo: foo}
})
parse("{"foo": 3}", decoder),
// will return Ok({foo: 3})
The json library returns string errors.
let {parse: parse, decode: decode} = @json
let result = parse("[]", decode.boolean)
// Will return Error("not a boolean")
The @json package includes the expect function for aborting on error.
Use this when making quick scripts
let {parse: parse, decode: decode, expect: expect} = @json
let result = expect(parse("true", decode.boolean), "failed to decode")
// Will return Error("not a boolean")