{"id":19838950,"url":"https://github.com/objectionary/eo-json","last_synced_at":"2025-02-28T19:15:27.105Z","repository":{"id":41658560,"uuid":"482612876","full_name":"objectionary/eo-json","owner":"objectionary","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-28T09:54:52.000Z","size":136,"stargazers_count":6,"open_issues_count":8,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T16:44:08.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/objectionary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-04-17T19:18:07.000Z","updated_at":"2023-09-15T11:17:56.000Z","dependencies_parsed_at":"2024-02-13T14:25:55.920Z","dependency_job_id":"e372ff47-2acf-49d6-bacd-ed1338098cce","html_url":"https://github.com/objectionary/eo-json","commit_stats":{"total_commits":102,"total_committers":3,"mean_commits":34.0,"dds":0.2549019607843137,"last_synced_commit":"c914b999c175088e5d508f913341e6ce9bb83156"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Feo-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objectionary","download_url":"https://codeload.github.com/objectionary/eo-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209528,"owners_count":19927734,"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":"2024-11-12T12:19:41.389Z","updated_at":"2025-02-28T19:15:27.082Z","avatar_url":"https://github.com/objectionary.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://www.yegor256.com/images/books/elegant-objects/cactus.svg\" height=\"100px\" /\u003e\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/objectionary/eo-hamcrest)](http://www.rultor.com/p/objectionary/eo-hamcrest)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.eolang/eo-hamcrest.svg)](https://maven-badges.herokuapp.com/maven-central/org.eolang/eo-hamcrest)\n[![mvn](https://github.com/objectionary/eo-hamcrest/actions/workflows/mvn.yml/badge.svg)](https://github.com/objectionary/eo-hamcrest/actions/workflows/mvn.yml)\n[![codecov](https://codecov.io/gh/cqfn/eo/branch/master/graph/badge.svg)](https://codecov.io/gh/cqfn/eo)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/Graur/eo-tests/blob/master/LICENSE.txt)\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/b8b59692f3c8c973ac54/maintainability)](https://codeclimate.com/github/objectionary/eo-hamcrest/maintainability)\n[![Hits-of-Code](https://hitsofcode.com/github/graur/eo-hamcrest)](https://hitsofcode.com/github/graur/eo-hamcrest/view)\n![Code-Size](https://img.shields.io/github/languages/code-size/objectionary/eo-hamcrest)\n![Lines of code](https://img.shields.io/tokei/lines/github/objectionary/eo-hamcrest)\n\n[EOLANG](https://www.eolang.org) objects for JSON parsing.\n\nThe main idea is that everything is a json\n\nThis is how to create json object\n```\n+alias org.eolang.fs.json\n\n# The first way is to call the json method 'of-...'\n# It creates empty object/array or wrapped int/string\njson.of-object \u003e x1\njson.of-array \u003e x2\njson.of-int 42 \u003e x3\njson.of-string \"some string\" \u003e x4\n\n# The second way is to parse the json text\njson.parse \"{age: 21, name: \\\"John\\\"}\" \u003e x5\n```\n\nJSON string for the following examples (the name of the string is **data**)\n```\n{\n  \"id\": 1,\n  \"essence\": \"shelf\",\n  \"books\": [\n    {\n      \"title\": \"Winnie the Pooh\",\n      \"author\": \"Alexander Milne\"\n    },\n    {\n      \"title\": \"Hamlet\",\n      \"author\": \"William Shakespeare\"\n    }\n  ],\n  \"description\": {\n    \"color\": \"black\",\n    \"material\": \"wood\"\n  }\n}\n```\n\nSimple manipulations\n```\njson.parse data \u003e x\n\n# 'found' returns an array empty (if the item wasn't found)\n# or with one element (if the item was found).\n# If the array isn't empty, the element in it is also a json\n(x.found \"books\").at 0 \u003e books\n\n# 'with' operation puts the object in the field where we are now\nx.with key some-json \u003e new-x\n\nstdout \u003e @\n  sprintf\n    \"In the %s %s I took a book called %s\"\n    ((((x.found \"description\").at 0).found \"color\").at 0).as-string\n    ((x.found \"essence\").at 0).as-string\n    (((books.at 0).found \"title\").at 0).as-string \n```\n\nThe creation a new json object\n```\n# creating of empty json object\njson.object \u003e x\n\n# example of creating a filled json\nwith. \u003e x2\n  with.\n    with.\n      json.of-object\n      \"name\"\n      json.of-string \"shelf\"\n    \"color\"\n    json.of-string \"black wood\"\n  \"books\"\n  with.\n    with.\n      json.of-array\n      with.\n        with.\n          json.of-object\n          \"name\"\n          json.of-string \"War and Peace\"\n        \"age\"\n        json.of-int 1869\n    with.\n      with.\n        json.of-object\n        \"name\"\n        json.of-string \"Harry Potter\"\n      \"age\"\n      json.of-int 1997\n```\n\n**x2** after the previous block of code\n```\n{\n  books: [\n    {name: \"War and Peace\", age: 1869},\n    {name: \"Harry Potter\", age: 1997} \n  ],\n  name: \"shelf\",\n  color: \"black wood\" \n}\n```\n\n## How to Contribute\nFork this repository, make changes, send us a [pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).\nWe will review your changes and apply them to the `master` branch shortly,\nprovided they don't violate our quality standards. To avoid frustration,\nbefore sending us your pull request please run full Maven build:\n```bash\n$ mvn clean install -Pqulice\n```\n\nYou will need Maven 3.3+ and Java 8+.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Feo-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectionary%2Feo-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Feo-json/lists"}