{"id":26777862,"url":"https://github.com/tinybiggames/easyjson","last_synced_at":"2025-04-16T07:56:38.623Z","repository":{"id":282816469,"uuid":"949620026","full_name":"tinyBigGAMES/EasyJson","owner":"tinyBigGAMES","description":"EasyJson - Effortless JSON Handling for Delphi with Fluent Simplicity.","archived":false,"fork":false,"pushed_at":"2025-03-25T03:38:41.000Z","size":122,"stargazers_count":23,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T07:09:22.467Z","etag":null,"topics":["delphi","fluent-interface","json","json-library","method-chaining","win64"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinyBigGAMES.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tinyBigGAMES","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-03-16T21:03:28.000Z","updated_at":"2025-04-08T19:56:24.000Z","dependencies_parsed_at":"2025-03-17T05:36:57.147Z","dependency_job_id":null,"html_url":"https://github.com/tinyBigGAMES/EasyJson","commit_stats":null,"previous_names":["tinybiggames/easyjson"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FEasyJson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FEasyJson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FEasyJson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FEasyJson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyBigGAMES","download_url":"https://codeload.github.com/tinyBigGAMES/EasyJson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249215996,"owners_count":21231525,"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":["delphi","fluent-interface","json","json-library","method-chaining","win64"],"created_at":"2025-03-29T05:18:15.284Z","updated_at":"2025-04-16T07:56:38.604Z","avatar_url":"https://github.com/tinyBigGAMES.png","language":"Pascal","readme":"# ![EasyJson](media/easyjson.png)  \n[![Chat on Discord](https://img.shields.io/discord/754884471324672040?style=for-the-badge)](https://discord.gg/tPWjMwK) [![Follow on Bluesky](https://img.shields.io/badge/Bluesky-tinyBigGAMES-blue?style=for-the-badge\u0026logo=bluesky)](https://bsky.app/profile/tinybiggames.com)  \n\n## 🚀 Overview\n\n**`TEasyJson`** is a powerful and intuitive Delphi class that simplifies JSON manipulation. Designed with a fluent interface, it enables developers to seamlessly create, modify, and traverse JSON objects and arrays using method chaining. Whether handling simple key-value pairs or deeply nested structures, `TEasyJson` ensures efficiency, readability, and flexibility.\n\n## ✨ Features\n\n- 🚀 Fluent interface for effortless JSON manipulation  \n- 📂 Supports both JSON objects and arrays  \n- 🔗 Chainable methods for concise and readable code  \n- 🏗️ Easily constructs and modifies nested JSON structures  \n- 🎨 Provides formatted JSON output for better readability  \n- ⚡ Optimized for performance and efficiency  \n\n## 📥 Installation\n\nGetting started with `TEasyJson` is quick and easy:\n\n1. **Copy** `TEasyJson.pas` into your project.  \n2. **Add** `TEasyJson` to your `uses` clause.  \n3. **Start Coding!** Enjoy simplified JSON handling with method chaining.  \n\n## 🛠️ Usage\n\n### 🔹 Creating a JSON Object\n\n```delphi\nvar EJ: TEasyJson;\nbegin\n  EJ := TEasyJson.Create;\n  EJ.Put('name', 'Alice')\n    .Put('age', 25)\n    .AddArray('hobbies')\n    .Put(0, 'Reading')\n    .Put(1, 'Cycling');\n\n  WriteLn(EJ.Format());\nend;\n```\n\n#### 🏷️ Output:\n```json\n{\n  \"name\": \"Alice\",\n  \"age\": 25,\n  \"hobbies\": [\n    \"Reading\",\n    \"Cycling\"\n  ]\n}\n```\n\n### 🔹 Creating a JSON Object from a String\n```delphi\nvar EJ: TEasyJson;\nbegin\n  EJ := TEasyJson.Create('{\"name\":\"John\",\"age\":30}');\n  WriteLn(EJ.Format());\nend;\n```\n\n### 🔹 Adding and Modifying Values\n```delphi\nEJ.Put('email', 'alice@example.com');\nEJ.Put('age', 26); // Updates existing key\n```\n\n### 🔹 Working with JSON Arrays\n```delphi\nvar EJ: TEasyJson;\nbegin\n  EJ := TEasyJson.Create;\n  EJ.AddArray('numbers')\n    .Put(0, 10)\n    .Put(1, 20)\n    .Put(2, 30);\n\n  WriteLn(EJ.Format());\nend;\n```\n\n### 🔹 Nesting JSON Objects\n```delphi\nEJ.AddObject('address',\n  function(E: TEasyJson): TEasyJson\n  begin\n    Result := E.Put('city', 'New York')\n               .Put('zip', '10001');\n  end);\n```\n\n### 🔹 Accessing JSON Elements\n```delphi\nWriteLn(EJ['name'].AsString);  // Alice\nWriteLn(EJ['age'].AsInteger);  // 26\nWriteLn(EJ['hobbies'][1].AsString);  // Cycling\n```\n\n## 📖 API Reference\n\nThe `TEasyJson` class provides a robust set of methods and properties for seamless JSON manipulation.\n\n### 🔹 Constructors\n- `Create()` – Creates an empty JSON object.  \n- `Create(const AJson: string)` – Parses a JSON string.  \n- `Create(const AJsonValue: TJSONValue)` – Wraps an existing JSON value.  \n\n### 🔹 Methods\n- `Put(AKey: string; AValue: Variant): TEasyJson` – Adds or updates a key.  \n- `Put(AIndex: Integer; AValue: Variant): TEasyJson` – Sets an array element.  \n- `Add(AKey: string; AValue: Variant): TEasyJson` – Adds a new key-value pair.  \n- `AddArray(AKey: string): TEasyJson` – Adds an empty array.  \n- `AddObject(AKey: string; AFunc: TFunc\u003cTEasyJson, TEasyJson\u003e): TEasyJson` – Adds a nested object.  \n- `ToString(): string` – Returns a compact JSON string.  \n- `Format(): string` – Returns formatted JSON.  \n- `Count(): Integer` – Returns the number of elements.  \n- `AsString(): string` – Converts a JSON value to a string.  \n- `AsInt32r(): Int32` – Converts a JSON value to an int32.  \n- `AsFloat(): Double` – Converts a JSON value to a float.  \n- `AsBoolean(): Boolean` – Converts a JSON value to a boolean.  \n\n### 🔹 Properties\n- `Items[AKeyOrIndex: Variant]: TEasyJson` – Accesses elements by key or index.  \n\nSee `EasyJson.pas` for the full documented API.\n\n## 💬 Support \u0026 Resources\n\n- 🐞 **Report Issues:** [GitHub Issue Tracker](https://github.com/tinyBigGAMES/EasyJson/issues)  \n- 💬 **Join the Community:** [Forum](https://github.com/tinyBigGAMES/EasyJson/discussions) | [Discord](https://discord.gg/tPWjMwK)  \n- 📚 **Learn Delphi:** [Learn Delphi](https://learndelphi.org)  \n\n## 🤝 Contributing\n\nWe welcome contributions to **EasyJson**! 🚀  \n\n### 💡 Ways to Contribute:\n- 🐛 **Report Bugs** – Help improve `TEasyJson` by submitting issues.  \n- ✨ **Suggest Features** – Share ideas to enhance its functionality.  \n- 🔧 **Submit Pull Requests** – Improve the codebase and add features.  \n\n### 🏆 Contributors\n\n\u003ca href=\"https://github.com/tinyBigGAMES/EasyJson/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=tinyBigGAMES/EasyJson\u0026max=250\u0026columns=10\u0026anon=1\" /\u003e\n\u003c/a\u003e\n\n## 📜 License\n\n**EasyJson** is distributed under the **BSD-3-Clause License**, allowing redistribution and modification in both source and binary forms. \nSee the [LICENSE](https://github.com/tinyBigGAMES/EasyJson?tab=BSD-3-Clause-1-ov-file#BSD-3-Clause-1-ov-file) for details.\n\n## 💖 Support \u0026 Sponsorship\n\nYour support keeps **EasyJson** evolving! If you find this library useful, please consider [sponsoring the project](https://github.com/sponsors/tinyBigGAMES). Every contribution helps drive future enhancements and innovations.\n\n### Other ways to support:\n- ⭐ **Star the repo** – Show your appreciation.  \n- 📢 **Share with your network** – Spread the word.  \n- 🐛 **Report bugs** – Help improve `TEasyJson`.  \n- 🔧 **Submit fixes** – Contribute by fixing issues.  \n- 💡 **Suggest features** – Help shape its future.  \n\n🚀 Every contribution makes a difference – thank you for being part of the journey!  \n  \n---\n\n🔥 *EasyJson – Effortless JSON Handling for Delphi with Fluent Simplicity.*\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"media/delphi.png\" alt=\"Delphi\"\u003e\n\u003c/p\u003e\n\u003ch5 align=\"center\"\u003eMade with ❤️ in Delphi\u003c/h5\u003e\n\n","funding_links":["https://github.com/sponsors/tinyBigGAMES"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Feasyjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybiggames%2Feasyjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Feasyjson/lists"}