mumu 0.10.0

Lava Mumu is a language for those in the now and that know
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
  "id": "fn-json-decode",
  "dataComponent": "json",
  "heading": {
    "title": "decode",
    "badges": ["JSON", "PARTIAL"]
  },
  "synopsis": "Parses a JSON string (or reads from an InkIterator / InkTransform of character codes / string chunks) and converts it into a Lava Value.",
  "codeBlocks": [
    "extend(\"json\")\n\n# 1) Decode a simple JSON string\ndata = json:decode('{\"name\":\"Alice\",\"age\":30}')\nsput(data)\n# => [ name:\"Alice\", age:30 ] (a keyed_array)\n\n# 2) Partial usage => no arguments yet\nmyPartial = json:decode()\nresult = myPartial('{\"ok\":true}')\nsput(result)\n# => [ ok:true ]\n\n# 3) Decoding from an InkIterator of ASCII char codes\niter = ink(91, 92, 93)   # i.e. ASCII for '[' ']' or any chunk\nsput( json:decode(iter) )\n\n# 4) If your transform yields text fragments or char codes, json:decode can gather them until done.\n\n# 5) Common return types:\n#    - bool, int, float, single-string, keyed_array, int_array, float_array, str_array, etc.\n"
  ],
  "notes": [
    "Takes exactly 1 argument if fully applied, which can be:\n- A single string (like '{\"key\":\"value\"}'),\n- A StrArray of length 1 (treated as a single JSON string),\n- An InkIterator or InkTransform producing ASCII characters or string chunks.\n\nIf you call `json:decode()` with no arguments, it returns a partial function waiting for that argument.",
    "On success, returns a Lava `Value` that matches the JSON structure (bool, int, float, KeyedArray, etc.). Null is converted to a placeholder `_` by default (or whichever bridging logic you configured).",
    "If the JSON is invalid, an error is raised. If reading from an InkIterator or Transform, we gather characters until EOF or an error occurs."
  ]
}