{"id":20279061,"url":"https://github.com/t-vk/nodemcu-json","last_synced_at":"2026-05-05T16:05:44.004Z","repository":{"id":107367300,"uuid":"90400435","full_name":"T-vK/NodeMCU-JSON","owner":"T-vK","description":"JSON parser for NodeMCU - Parses gigantic JSON strings without any memory issues.","archived":false,"fork":false,"pushed_at":"2017-05-05T17:59:42.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T07:11:18.871Z","etag":null,"topics":["json","json-parser","lua","nodemcu"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/T-vK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-05T17:24:43.000Z","updated_at":"2018-03-30T01:45:01.000Z","dependencies_parsed_at":"2023-04-26T20:01:07.301Z","dependency_job_id":null,"html_url":"https://github.com/T-vK/NodeMCU-JSON","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FNodeMCU-JSON","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FNodeMCU-JSON/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FNodeMCU-JSON/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-vK%2FNodeMCU-JSON/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/T-vK","download_url":"https://codeload.github.com/T-vK/NodeMCU-JSON/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768278,"owners_count":20017129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","json-parser","lua","nodemcu"],"created_at":"2024-11-14T13:27:58.949Z","updated_at":"2026-05-05T16:05:43.972Z","avatar_url":"https://github.com/T-vK.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express.js-like HTTP server library for NodeMCU\n\n## About\nI wrote this JSON parser because the ESP8266 has very tight memory constraints.  \nA normal JSON parser requires you to load the JSON string into a variable and then craetes a gigantic table that contains all the information form the string. This is INCREDIBLY memory intensise.  \nBut I came up with the ingenious idea of parsing a JSON string of almost arbitrary size by reading it from directly form a storage device (not RAM).\nIt only stores one single character of the JSON string at a time in the RAM and immediately discards it if it is irrelevant. \nSo now you can easily parse and access a JSON string that it 100 times bigger than your RAM wihtout any issues.\n\n## The interface\nUsing some metatable magic I created an interface that allows to access/parse a json string at a specified place, by almost accessing it like a table.  \nWhile you would access a table like this for instance: `foo['bar'][123]['name']`, you have to do `foo['bar'][123]['name']()` instead.\nIf the value you are trying to access is an array/object then it will return a table that only contains the keys/indexes of the direct children.  \nThis is enough to start iteration over it.\n\n## Use cases\nI mainly developed this libary to be used by HTTP server libraries. The idea is that a json request body can be received in chunks and be written into a file.  \nThis way  you never have to store the json request body in your memory, but jsut on the flash.  \nThen this library can read the string from the file one byte at a time and parse it this way.\n\n## Examples\n``` Lua\nlocal example =  json('example.json') -- Specify which file you want to read the JSON string from\n\n-- Read a value\nlocal value = example[\"aa\"][2]['k1']() -- Notice the brackets in the end!\nprint(value)\n\n-- Loop over a key value table and print the keys and values\nfor key, value in pairs(example[\"aa\"][2]()) do\n    print('key: ' .. key, 'value: ' .. example[\"aa\"][2][key]())\nend\n```\n\n## Need help? Have a feature request? Found a bug?\nCreate an issue right here on github.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-vk%2Fnodemcu-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-vk%2Fnodemcu-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-vk%2Fnodemcu-json/lists"}