{"id":31752057,"url":"https://github.com/ysdragon/simplejson","last_synced_at":"2025-10-09T16:55:05.940Z","repository":{"id":317190276,"uuid":"1066357194","full_name":"ysdragon/simplejson","owner":"ysdragon","description":"Simple Ring bindings for the Jansson JSON library","archived":false,"fork":false,"pushed_at":"2025-09-29T12:16:22.000Z","size":468,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-29T13:25:07.126Z","etag":null,"topics":["jansson","json","ring-lang","ring-programming-language"],"latest_commit_sha":null,"homepage":"","language":"Ring","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/ysdragon.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":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T11:25:34.000Z","updated_at":"2025-09-29T12:17:00.000Z","dependencies_parsed_at":"2025-09-29T13:25:11.976Z","dependency_job_id":"b0036721-32de-4dc2-9553-7383f28e76f8","html_url":"https://github.com/ysdragon/simplejson","commit_stats":null,"previous_names":["ysdragon/simplejson"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ysdragon/simplejson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fsimplejson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fsimplejson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fsimplejson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fsimplejson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysdragon","download_url":"https://codeload.github.com/ysdragon/simplejson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysdragon%2Fsimplejson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001778,"owners_count":26083173,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["jansson","json","ring-lang","ring-programming-language"],"created_at":"2025-10-09T16:55:04.409Z","updated_at":"2025-10-09T16:55:05.935Z","avatar_url":"https://github.com/ysdragon.png","language":"Ring","readme":"# Ring SimpleJSON\n\n[license]: https://img.shields.io/github/license/ysdragon/simplejson?style=for-the-badge\u0026logo=opensourcehardware\u0026label=License\u0026logoColor=C0CAF5\u0026labelColor=414868\u0026color=8c73cc\n[![][license]](https://github.com/ysdragon/simplejson/blob/master/LICENSE)\n\nAn easy-to-use JSON parsing and manipulation library for the Ring programming language. This library is built as a C extension that wraps the high-performance [`Jansson`](https://github.com/akheron/jansson) C JSON library.\n\n## ✨ Features\n\n-   **Parse JSON Strings**: Convert JSON strings into Ring data structures (lists)\n-   **Generate JSON**: Convert Ring lists into formatted JSON strings\n-   **High Performance**: Built on the fast Jansson C library for optimal speed\n-   **Cross-Platform**: Works seamlessly across Windows, Linux, macOS, and FreeBSD\n-   **Error Handling**: Comprehensive error reporting for malformed JSON\n\n## 📋 Prerequisites\n\n-   **Ring Language**: Ensure you have Ring version 1.23 or higher installed. You can download it from the [official Ring website](https://ring-lang.github.io/download.html).\n\n## 🚀 Installation\n\n### Using RingPM\n\nThe recommended way to install Ring SimpleJSON is through the Ring Package Manager (RingPM).\n\n```bash\nringpm install simplejson from ysdragon\n```\n\n## 💡 Usage\n\nFirst, load the library in your Ring script:\n\n```ring\nload \"simplejson.ring\"\n```\n\n### Parsing JSON Strings\n\nConvert JSON strings into Ring lists:\n\n```ring\njsonString = '{\"name\": \"Ring\", \"version\": 1.23, \"features\": [\"fast\", \"simple\", \"flexible\"]}'\n\ndata = json_decode(jsonString)\n\n# Access data using Ring list syntax\n? data[:name]        # Output: Ring\n? data[:version]     # Output: 1.23\n? data[:features][1]  # Output: fast\n```\n\n### Generating JSON\n\nConvert Ring lists into JSON strings:\n\n```ring\n# Create a Ring list structure\nmyData = [\n    [\"name\", \"Ring Language\"],\n    [\"version\", 1.23],\n    [\"features\", [\"fast\", \"simple\", \"flexible\"]],\n    [\"active\", 1]  # true in JSON\n]\n\n# Convert to JSON string\njsonString = json_encode(myData)\n? jsonString\n# Output: {\"name\": \"Ring Language\", \"version\": 1.23, \"features\": [\"fast\", \"simple\", \"flexible\"], \"active\": true}\n\n# Pretty-print with indentation (optional second parameter)\nprettyJson = json_encode(myData, 1)\n? prettyJson\n```\n\n### Working with Complex Data\n\n```ring\n# Nested structure\nuserProfile = [\n    [\"user\", [\n        [\"name\", \"John Doe\"],\n        [\"age\", 30],\n        [\"email\", \"john@example.com\"]\n    ]],\n    [\"preferences\", [\n        [\"theme\", \"dark\"],\n        [\"notifications\", 1]  # true\n    ]],\n    [\"posts\", [\n        [\"title\", \"Hello World\", \"content\", \"First post\"],\n        [\"title\", \"JSON in Ring\", \"content\", \"Using SimpleJSON library\"]\n    ]]\n]\n\n# Encode to JSON\njsonData = json_encode(userProfile, 1)\n? jsonData\n\n# Decode back to Ring structure\ndecodedData = json_decode(jsonData)\n? decodedData[:user][:name]  # Output: John Doe\n```\n\n## 📚 API Reference\n\n### `json_decode(jsonString)`\n\nParses a JSON string into a Ring list structure.\n\n-   **Parameters:**\n    -   `jsonString` (string): The JSON string to parse\n-   **Returns:** A Ring list containing the parsed data\n\n### `json_encode(ringList [, prettyPrint])`\n\nConverts a Ring list structure into a JSON string.\n\n-   **Parameters:**\n    -   `ringList`: The Ring list to convert\n    -   `prettyPrint` (optional): Pass `1`/`TRUE` to format JSON with indentation, `0`/`FALSE` or omit for compact format\n-   **Returns:** A JSON string representation of the list data\n\n### `json_version()`\n\nReturns the version of the underlying Jansson library.\n\n-   **Parameters:** None\n-   **Returns:** A string representing the Jansson library version\n\n## 🛠️ Development\n\nIf you wish to contribute to the development of Ring SimpleJSON or build it from the source, follow these steps.\n\n### Prerequisites\n\n-   **CMake**: Version 3.16 or higher.\n-   **C Compiler**: A C compiler compatible with your platform (e.g., GCC, Clang, MSVC).\n-   **Ring Source Code**: You will need to have the Ring language source code available on your machine.\n\n### Build Steps\n\n1.  **Clone the Repository:**\n    ```sh\n    git clone https://github.com/ysdragon/simplejson.git --recursive\n    ```\n    \u003e **Note**: If you installed the library via RingPM, you can skip this step.\n\n2.  **Set the `RING` Environment Variable:**\n    This variable must point to the root directory of the Ring language source code.\n\n    -   **Windows (Command Prompt):**\n        ```cmd\n        set RING=X:\\path\\to\\ring\n        ```\n    -   **Windows (PowerShell):**\n        ```powershell\n        $env:RING = \"X:\\path\\to\\ring\"\n        ```\n    -   **Unix-like Systems (Linux, macOS or FreeBSD):**\n        ```bash\n        export RING=/path/to/ring\n        ```\n\n3.  **Configure with CMake:**\n    Create a build directory and run CMake from within it.\n    ```sh\n    mkdir build\n    cd build\n    cmake ..\n    ```\n\n4.  **Build the Project:**\n    Compile the source code using the build toolchain configured by CMake.\n    ```sh\n    cmake --build .\n    ```\n\n    The compiled library will be available in the `lib/\u003cos\u003e/\u003carch\u003e` directory.\n\n## 🤝 Contributing\n\nContributions are always welcome! If you have suggestions for improvements or have identified a bug, please feel free to open an issue or submit a pull request.\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [`LICENSE`](LICENSE) file for more details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Fsimplejson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysdragon%2Fsimplejson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysdragon%2Fsimplejson/lists"}