{"id":28418726,"url":"https://github.com/lendable/json-serializer","last_synced_at":"2025-06-28T04:31:10.069Z","repository":{"id":36966650,"uuid":"159189159","full_name":"Lendable/json-serializer","owner":"Lendable","description":"Library dealing with common tasks for JSON (de-) serialiazation","archived":false,"fork":false,"pushed_at":"2025-06-20T14:10:19.000Z","size":3097,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-06-20T15:26:48.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/Lendable.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,"zenodo":null}},"created_at":"2018-11-26T15:16:10.000Z","updated_at":"2025-05-03T21:37:24.000Z","dependencies_parsed_at":"2023-12-27T15:23:57.643Z","dependency_job_id":"3d350c18-b1ee-4ce6-a618-12808c9a8be9","html_url":"https://github.com/Lendable/json-serializer","commit_stats":{"total_commits":324,"total_committers":9,"mean_commits":36.0,"dds":0.3950617283950617,"last_synced_commit":"01d6b2a089f410da9e6c9cf774996114f6344675"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Lendable/json-serializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lendable%2Fjson-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lendable%2Fjson-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lendable%2Fjson-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lendable%2Fjson-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lendable","download_url":"https://codeload.github.com/Lendable/json-serializer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lendable%2Fjson-serializer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262375572,"owners_count":23301305,"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":[],"created_at":"2025-06-04T12:20:25.858Z","updated_at":"2025-06-28T04:31:10.061Z","avatar_url":"https://github.com/Lendable.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lendable JSON Serializer\n=============\n[![Latest Stable Version](https://poser.pugx.org/lendable/json-serializer/v/stable)](https://packagist.org/packages/lendable/json-serializer)\n[![License](https://poser.pugx.org/lendable/json-serializer/license)](https://packagist.org/packages/lendable/json-serializer)\n\nProvides an opinionated object oriented interface for handling JSON serialization and deserialization in PHP. \n\n## Features\n* Throws exceptions on serialization and deserialization failure.\n* Sane default serialization flags.\n\n## Installation\n ```bash\t\n composer require lendable/json-serializer\n ```\n\n## Why? Opinionated?\nThis library aids to simplify our most common usage patterns of JSON at Lendable by providing a strict and limited API, and not a generic solution.\n\n### Type safety\nWe follow the pattern of converting object graph(s) to data array(s) and then to JSON, this library fits into the `data array(s) \u003c=\u003e json` part of that flow. Due to this, it is restrictive in what can be serialized and deserialized as for our use case, these are error conditions. Data is deserialized always as a numeric (array root element) or an associative array (object root element). Therefore, this library may _not_ fit your use case.\n\n### Error handling\nThe default `json_encode()` and `json_decode()` global functions from `ext-json` are still used, but delegated to in a safe manner. The potential error reporting from these functions can be:\n\n* A `false` return value - except `json_decode('false')` also returns false, and isn't an error.\n* Retrieved as code or message via `json_last_error()` or `json_last_error_msg()` - requires being checked every time.\n* An exception via the `JSON_THROW_ON_ERROR` option in PHP 7.3 - requires opt-in to the functionality.\n\nThis library will always throw exceptions on serialization and deserialization failures, simplifying calling logic.\n\n## API\n\n### Serialization `Serializer::serialize(array $data): string`\nSerializes a data array into a JSON string.\n\nThrows `SerializationFailed` on failure to serialize.\n\n### Deserialization `Serializer::deserialize(string $json): array`\nDeserializes a JSON string into an `array`.\n\nThrows `DeserializationFailed` on failure to deserialize.\nThrows `InvalidDeserializedData` if the data type of the resulting deserialized data is not an `array`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flendable%2Fjson-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flendable%2Fjson-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flendable%2Fjson-serializer/lists"}