{"id":20455880,"url":"https://github.com/formspark/formson","last_synced_at":"2026-02-18T13:36:08.638Z","repository":{"id":255676364,"uuid":"853263859","full_name":"formspark/formson","owner":"formspark","description":"FormData to JSON converter","archived":false,"fork":false,"pushed_at":"2024-09-06T14:49:47.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T06:28:09.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formspark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-09-06T10:05:35.000Z","updated_at":"2025-01-03T11:01:16.000Z","dependencies_parsed_at":"2024-09-06T17:49:02.964Z","dependency_job_id":null,"html_url":"https://github.com/formspark/formson","commit_stats":null,"previous_names":["formspark/formson"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/formspark/formson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formspark%2Fformson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formspark%2Fformson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formspark%2Fformson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formspark%2Fformson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formspark","download_url":"https://codeload.github.com/formspark/formson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formspark%2Fformson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29580810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-15T11:20:17.829Z","updated_at":"2026-02-18T13:36:03.628Z","avatar_url":"https://github.com/formspark.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Formson\n\nFormson is a FormData to JSON converter.\n\nIt supports:\n\n- Dot notation to create nestable objects\n- Square bracket notation to create arrays\n- Mixed object/array structures\n\nSponsored by \u003ca href=\"https://formspark.io\"\u003eFormspark\u003c/a\u003e, the simple \u0026 powerful form solution for developers.\n\n## Installation\n\nAdd the Formson script.\n\n```html\n\u003cscript src=\"https://unpkg.com/@formspark/formson\"\u003e\u003c/script\u003e\n```\n\nYou can now use the `Formson.toJSON` function to convert a FormData object to a JSON object.\n\n```javascript\nconst json = Formson.toJSON(formData);\n```\n\n## Examples\n\n### Basic example\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cscript src=\"https://unpkg.com/@formspark/formson\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eExample\u003c/h1\u003e\n    \u003cform id=\"form\"\u003e\n      \u003cinput name=\"firstName\" /\u003e\n      \u003cinput name=\"lastName\" /\u003e\n      \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n\n    \u003cscript\u003e\n      document\n        .getElementById(\"form\")\n        .addEventListener(\"submit\", function (event) {\n          event.preventDefault();\n          const formData = new FormData(this);\n          const json = Formson.toJSON(formData);\n          alert(JSON.stringify(json));\n        });\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Dot notation\n\nDot notation uses periods (`.`) to create nested objects.\n\n```html\n\u003cform\u003e\n  \u003cinput name=\"user.firstName\" value=\"John\" /\u003e\n  \u003cinput name=\"user.lastName\" value=\"Doe\" /\u003e\n\u003c/form\u003e\n```\n\nThis will result in the following JSON structure:\n\n```json\n{\n  \"user\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\"\n  }\n}\n```\n\n### Square bracket notation\n\nSquare bracket notation uses square brackets (`[]`) to create arrays.\n\n```html\n\u003cform\u003e\n  \u003cinput name=\"users[0]\" value=\"Alice\" /\u003e\n  \u003cinput name=\"users[1]\" value=\"Bob\" /\u003e\n  \u003cinput name=\"users[2]\" value=\"Charlie\" /\u003e\n\u003c/form\u003e\n```\n\nThis will result in the following JSON structure:\n\n```json\n{\n  \"users\": [\"Alice\", \"Bob\", \"Charlie\"]\n}\n```\n\n### Complex structure\n\nYou can mix dot and square bracket notation to create complex structures.\n\n```html\n\u003cform\u003e\n  \u003cinput type=\"text\" name=\"user.name\" value=\"John Doe\" /\u003e\n\n  \u003cinput type=\"text\" name=\"user.skills[0]\" value=\"JavaScript\" /\u003e\n  \u003cinput type=\"text\" name=\"user.skills[1]\" value=\"TypeScript\" /\u003e\n    \n  \u003cinput type=\"text\" name=\"user.address.street\" value=\"123 Main St\" /\u003e\n  \u003cinput type=\"text\" name=\"user.address.city\" value=\"Anytown\" /\u003e\n    \n  \u003cinput type=\"text\" name=\"user.projects[0].name\" value=\"Project A\" /\u003e\n  \u003cinput type=\"text\" name=\"user.projects[0].tasks[0]\" value=\"Task 1\" /\u003e\n  \u003cinput type=\"text\" name=\"user.projects[0].tasks[1]\" value=\"Task 2\" /\u003e\n  \u003cinput type=\"text\" name=\"user.projects[1].name\" value=\"Project B\" /\u003e\n  \u003cinput type=\"text\" name=\"user.projects[1].tasks[0]\" value=\"Task 3\" /\u003e\n  \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\nThis will result in the following JSON structure:\n\n```json\n{\n  \"user\": {\n    \"name\": \"John Doe\",\n    \"skills\": [\"JavaScript\", \"TypeScript\"],\n    \"address\": {\n      \"street\": \"123 Main St\",\n      \"city\": \"Anytown\"\n    },\n    \"projects\": [\n      {\n        \"name\": \"Project A\",\n        \"tasks\": [\"Task 1\", \"Task 2\"]\n      },\n      {\n        \"name\": \"Project B\",\n        \"tasks\": [\"Task 3\"]\n      }\n    ]\n  }\n}\n```\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformspark%2Fformson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformspark%2Fformson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformspark%2Fformson/lists"}