{"id":36419647,"url":"https://github.com/lni-dev/data","last_synced_at":"2026-01-11T17:05:12.850Z","repository":{"id":41909562,"uuid":"473712990","full_name":"lni-dev/data","owner":"lni-dev","description":"A Java library to store data and parse it to JSON","archived":false,"fork":false,"pushed_at":"2025-09-14T01:03:39.000Z","size":359,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-14T01:20:25.214Z","etag":null,"topics":["java","json","jsonparser"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lni-dev.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,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-24T17:44:42.000Z","updated_at":"2025-09-14T01:03:43.000Z","dependencies_parsed_at":"2025-03-05T19:19:18.925Z","dependency_job_id":"c481e0eb-d489-49ca-927d-f60347423ac3","html_url":"https://github.com/lni-dev/data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lni-dev/data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lni-dev%2Fdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lni-dev%2Fdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lni-dev%2Fdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lni-dev%2Fdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lni-dev","download_url":"https://codeload.github.com/lni-dev/data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lni-dev%2Fdata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28314264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"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":["java","json","jsonparser"],"created_at":"2026-01-11T17:05:12.785Z","updated_at":"2026-01-11T17:05:12.842Z","avatar_url":"https://github.com/lni-dev.png","language":"Java","readme":"# Data \nData is used to store information and convert it to JSON\nor convert JSON to Data objects\n\n\n## Installation ![Maven Central](https://img.shields.io/maven-central/v/de.linusdev/data?label=current%20newest%20version%3A%20)\nAdd it as implementation to your build.gradle. \n```groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'de.linusdev:data:[version]'\n}\n```\nReplace `[version]` with the version you want to use.\n\n## Getting Started\nA data can be converted to a json string and vice verca.\n### SOData to Json\nFirst create a data using the static methods of `SOData`. `SOData.newOrderedDataWithKnownSize(10)` will create a new\ndata, which is backed by an `ArrayList` with the initial capacity 10. It is possible to add more than 10 entries.\n\u003cbr\u003e\u003cbr\u003e\nThe simplest way of adding entries to a data is by using the add function: `add(String key, Object value)`.\nvalue can be any primitive data type, String, Array, Collection or Datable.\n\u003cbr\u003e\u003cbr\u003e\nTo parse the data to a json-string simply call the `toJsonString()` method:\n```java\n//create a new data\nSOData data = SOData.newOrderedDataWithKnownSize(10);\n\n//add entries\ndata.add(\"key\", \"value\");\ndata.add(\"a int\", 10);\ndata.add(\"something else\", new String[]{\"1\", \"a\", \"2\"});\n\n//parse it to a json string\nSystem.out.println(data.toJsonString());\n```\n\nThe output will look like that:\n```json\n{\n\t\"key\": \"value\",\n\t\"a int\": 10,\n\t\"something else\": [\n\t\t\"1\",\n\t\t\"a\",\n\t\t\"2\"\n\t]\n}\n```\n\n### Json to SOData\nTo parse a json string to a data you need to get a instance of a `JsonParser`:\n```java\nJsonParser parser = new JsonParser();\n```\nWith this parser you can parse a `Reader` or an `Inputstream`:\n```java\nSOData dataFromReader = parser.parseReader(reader);\nSOData dataFromStream = parser.parseStream(inputStream);\n```\nHere is an example of parsing a `String` to a `SOData`:\n```java\nString json = \"{...}\";\nReader reader = new StringReader(json);\n        \nJsonParser parser = new JsonParser();\nSOData data = parser.parseReader(reader);\n```\nIf you want to parse a json array to a data you can use the function `setArrayWrapperKey(String key)`. After parsing the\narray will then be accessible with the given key as a `List\u003cObject\u003e`:\n```java\nString json = \"[1,2,3]\";\nReader reader = new StringReader(json);\n\nJsonParser parser = new JsonParser();\nparser.setArrayWrapperKey(\"array\");\n\nSOData data = parser.parseReader(reader);\nList\u003cObject\u003e list = data.getList(\"array\");\n\nSystem.out.println(list);\n```\nThe above code will give the following output:\n```js\n[1,2,3]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flni-dev%2Fdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flni-dev%2Fdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flni-dev%2Fdata/lists"}