{"id":19603110,"url":"https://github.com/tarantinoarchive/won","last_synced_at":"2025-04-27T17:32:39.525Z","repository":{"id":57398866,"uuid":"266893021","full_name":"TarantinoArchive/won","owner":"TarantinoArchive","description":"A new way to see HTML Web Pages","archived":false,"fork":false,"pushed_at":"2020-06-01T12:49:11.000Z","size":476,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-19T11:54:54.753Z","etag":null,"topics":["algorithm","cli","comparison","convertions","css","css-parsing","development","html","html-page","js-binding","json","languages","languages-binding","npm","web","won"],"latest_commit_sha":null,"homepage":"https://gianlucatarantino.github.io/won/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TarantinoArchive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null},"funding":{"patreon":"GianlucaTarantino"}},"created_at":"2020-05-25T22:33:00.000Z","updated_at":"2025-03-10T16:10:17.000Z","dependencies_parsed_at":"2022-09-09T16:01:47.553Z","dependency_job_id":null,"html_url":"https://github.com/TarantinoArchive/won","commit_stats":null,"previous_names":["gianlucatarantino/won"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TarantinoArchive%2Fwon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TarantinoArchive%2Fwon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TarantinoArchive%2Fwon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TarantinoArchive%2Fwon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TarantinoArchive","download_url":"https://codeload.github.com/TarantinoArchive/won/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251178058,"owners_count":21548156,"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":["algorithm","cli","comparison","convertions","css","css-parsing","development","html","html-page","js-binding","json","languages","languages-binding","npm","web","won"],"created_at":"2024-11-11T09:28:08.116Z","updated_at":"2025-04-27T17:32:36.511Z","avatar_url":"https://github.com/TarantinoArchive.png","language":"JavaScript","funding_links":["https://patreon.com/GianlucaTarantino"],"categories":[],"sub_categories":[],"readme":"# WON\n## Web Object Notation\n![ ](/assets/wonlogo.png)\n## Introduction\nWon is a multi purpose HTML/CSS to JSON (and vice-versa) converting tool. It is very useful for various applications in the field of web development, for example it helps a lot in web pages parsing and modification in some tedious languages like C, because all you have to do is use an easy JSON.\nI made WON because recently, while making a web scraping project with C++, I noticed that in languages like this is very difficult to get a code (and human) friendly representation of an HTML page. (It is also my very first Open Source Project!)\n\n## Table of Contents\n1. [How is it made](#how-is-it-made)\n2. [How does it works (CLI)](#how-does-cli-works)\n3. [How does it works (JS)](#how-does-js-binding-works)\n4. [Comparison](#comparison)\n5. [Features](#features)\n6. [How to install](#how-to-install)\n7. [Support](#support)\n\n### How is it made?\nIt is currently made in Node.JS, using [htmlparser2](https://www.npmjs.com/package/htmlparser2) (go check their [repo](https://github.com/fb55/htmlparser2), this is an awesome Node Package) because this was the fastest implementation for HTML parsing on the NPM scenario.\n\n(For the CSS Parsing I was struggling a bit, then I found an [answer](https://stackoverflow.com/questions/5240778/css-to-json-parser-or-converter/60451920#60451920) on Stack Overflow with a pretty decent already made algorithm for CSS parsing, so I said \"Why not?\". I just increased the readability of the code, but the algorithm is took from that answer.)\n### How does CLI works\nIt is currently a CLI utility and a JS library. Alongside the JS version, other languages binding will be developed.\n\nUsing `won -hj pathToFile.html` you will get a JSON output file, structured like a valid WON Object. Using `won -jh pathToFile.json` you will get a HTML file. Same for CSS, but use a `c` instead of the `h` (example: `won -cj pathToFile.css`). Add `-o outputName.o` to determine a name for the output file.\n\n### How does JS binding works\nAlongside the JS version, other languages binding will be developed.\n\n**Example code**\n\n\n```javascript\nconst won = require(\"won\");\nlet exampleHTML = `\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003eTest\u003c/title\u003e\n    \u003chead\u003e\n\u003c/html\u003e\n`\nlet wonObject = won.HTMLtoJSON(exampleHTML);\nconsole.log(wonObject.children[0].children[0].text); // Test\n```\nIn the next paragraph, there is the correct WON Object Structure.\nFor more documentation on functions, parameters and return types, check [won.js](https://github.com/GianlucaTarantino/won/blob/master/won.js).\n\n\n### Comparison\n\nHTML  | JSON\n:----:|:-----:\n![ ](./assets/exampleHTML.png) | ![ ](./assets/exampleJSON.png)\n\n**JSON is quite longer than the HTML document, but it can be easily read by most languages**\n\n\n## Features\n\n(✅) Done | (❎) Work in Progress | (🔜) Will soon be WIP\n\n- HTML to JSON (✅)\n- JSON to HTML (✅)\n- Installing to PATH via NPM (✅)\n- Adding help in CLI (✅)\n- CSS to JSON (✅)\n- JSON to CSS (✅)\n- JavaScript binding (✅)\n- Other Languages binding (🔜)\n- Tools using WON (🔜)\n\n## How to install\nCurrently, is supported manual installation, and NPM installation.\n\nNPM Installation:\n1. In terminal, write `sudo npm install won-js -g`\n2. Enjoy!\n\nManual Installation:\n1. In terminal, write `git clone https://github.com/GianlucaTarantino/won.git` (or just download the repo)\n2. Go to the repository directory\n3. In terminal, write `sudo npm link` \n4. Enjoy!\n\nNow you can use WON as described before!\n\n## Support\nFor support, just create an issue or contact me at gianlutara@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantinoarchive%2Fwon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarantinoarchive%2Fwon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantinoarchive%2Fwon/lists"}