en un clic
decoding-json
Decode and parse JSON strings with EYG.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Decode and parse JSON strings with EYG.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
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.
| 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")