{"id":20542810,"url":"https://github.com/andrewrgarcia/bridge","last_synced_at":"2026-04-16T04:02:37.388Z","repository":{"id":45812217,"uuid":"514674837","full_name":"andrewrgarcia/bridge","owner":"andrewrgarcia","description":"Connecting arrays between Python and C++","archived":false,"fork":false,"pushed_at":"2022-10-14T23:49:21.000Z","size":134,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T10:45:04.467Z","etag":null,"topics":["array","bridge","cpp","hacktoberfest","json","matrix","port","programming-languages","python","tensor","transformation","translation"],"latest_commit_sha":null,"homepage":"","language":"C++","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/andrewrgarcia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-16T20:07:50.000Z","updated_at":"2022-10-19T18:49:41.000Z","dependencies_parsed_at":"2023-01-20T02:03:33.251Z","dependency_job_id":null,"html_url":"https://github.com/andrewrgarcia/bridge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewrgarcia/bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewrgarcia%2Fbridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewrgarcia%2Fbridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewrgarcia%2Fbridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewrgarcia%2Fbridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewrgarcia","download_url":"https://codeload.github.com/andrewrgarcia/bridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewrgarcia%2Fbridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["array","bridge","cpp","hacktoberfest","json","matrix","port","programming-languages","python","tensor","transformation","translation"],"created_at":"2024-11-16T01:34:31.172Z","updated_at":"2026-04-16T04:02:37.346Z","avatar_url":"https://github.com/andrewrgarcia.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bridge\n\n![](logo.png)\nThis is an open-source suite of mini-libraries designed to connect array data between Python and C++ through the use of JSON files.\nPython and C++ modules use **tojson** and **jsonload** functions to convert [one- two- and three-dimensional] arrays to .json DOK (Dictionary of Keys) and viceversa, respectively. See Usage Examples below.\n\n## Contributions Welcome / Hacktoberfest\n\nMeaningful contributions to the project are always welcome. Participating in Hacktoberfest 2022. Before making a PR, please make sure to read the [CONTRIBUTING](./CONTRIBUTING.md) document.\n\nYou may use the Issues section of this repository if you'd like to propose some new ideas/enhancements or report a bug.\n\n\n## Installation / Setup\n\n### Dependencies\n\n#### [JSON for Modern C++](https://github.com/nlohmann/json)\n\n```ruby\n# Download JSON repository\ngit clone https://github.com/nlohmann/json.git\n\n# Access it\ncd json\n\n#copy as system variable\nsudo cp -R include/nlohmann/ /usr/include/nlohmann\n```\n\n### Bridge suite\n\n```ruby\n# Download this repository\ngit clone https://github.com/andrewrgarcia/bridge.git\n\n# Access it\ncd bridge\n\n#copy as system variable to call bridge.cpp from anywhere\nsudo cp -R include/garcia/ /usr/include/garcia\n\n# Get Python mini-library (\"ponte\")\npip install ponte\n\n```\n\n## Usage Examples\n\n**C++**\n\n```ruby\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n#include \u003cstdio.h\u003e\n#include \u003cgarcia/bridge.hpp\u003e\n\nint main()\n{\n    // CREATE A VECTORIZED ARRAY\n    std::vector\u003cint\u003e vector0(8, 1);\n    std::vector\u003cint\u003e DIMS = {2, 2, 2};\n    std::string filename{\"sample.json\"};\n    // pack vector to .json file\n    tojson(filename, vector0, DIMS);\n\n    // PROCESS JSON FILE BACK TO VECTOR\n    std::vector\u003cint\u003e vector = jsonload(filename);\n    // print vector\n    std::cout \u003c\u003c \"\\nvectorized array: \" \u003c\u003c std::endl;\n    for (int i = 0; i \u003c vector.size(); i++)\n    {\n        std::cout \u003c\u003c vector[i] \u003c\u003c \" \";\n    }\n    std::cout \u003c\u003c std::endl;\n}\n```\n\n**Python**\n\n```python\nimport ponte as bridge\nimport numpy as np\n\n'CREATE A 1-D VECTOR'\nX = np.random.choice([0,1,2,3],10,p=[0.7,0.1,0.1,0.1])\n'pack vector to .json file'\nbridge.tojson('sample.json',X)\n\n'PROCESS JSON FILE BACK TO VECTOR'\narray_form = bridge.jsonload('sample.json')\n'print vector'\nprint('array:\\n',array_form)\n```\n\n## Sample Output\n\n```ruby\narray to DOK:\n{\n\t\"map\": [\n\t\t[1],\n\t\t[4],\n\t\t[5],\n\t\t[8],\n\t\t[9]\n\t],\n\t\"value\": [2, 3, 2, 2, 2],\n\t\"odims\": [10]\n}\n\nDOK to array:\n[0. 2. 0. 0. 3. 2. 0. 0. 2. 2.]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewrgarcia%2Fbridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewrgarcia%2Fbridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewrgarcia%2Fbridge/lists"}