{"id":19806703,"url":"https://github.com/timnew/arduinojsonwriter","last_synced_at":"2025-05-01T07:31:03.306Z","repository":{"id":12463293,"uuid":"15127423","full_name":"timnew/ArduinoJsonWriter","owner":"timnew","description":"A lightweight library to make it easy to generate json document on Arduino board","archived":false,"fork":false,"pushed_at":"2020-11-30T22:52:39.000Z","size":10,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T10:52:17.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/timnew.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}},"created_at":"2013-12-12T05:06:50.000Z","updated_at":"2019-01-02T17:06:55.000Z","dependencies_parsed_at":"2022-09-13T20:54:18.759Z","dependency_job_id":null,"html_url":"https://github.com/timnew/ArduinoJsonWriter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2FArduinoJsonWriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2FArduinoJsonWriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2FArduinoJsonWriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2FArduinoJsonWriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timnew","download_url":"https://codeload.github.com/timnew/ArduinoJsonWriter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251840163,"owners_count":21652292,"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-12T09:08:19.791Z","updated_at":"2025-05-01T07:31:03.086Z","avatar_url":"https://github.com/timnew.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"ArduinoJsonWriter\n=================\n\nJson Writer is a light weight library that make it easier to generate json document on Arduino.\n\nThe library works pretty similar to the SAX for XML, it treats JSON as a stream of nodes. With the API, you can compose a JSON document by emitting each node.\n\n\nInitialize JsonWriter\n---------------------\nJsonWriter wraps a Stream instance, so it could be used to generate data for all kind of Stream based IO or starages, including: `Serial`, `Wire(I2C)`, `Ethernet TCP socket`, `SD`\n\n\n\tJsonWriter serialJsonWriter(Serial);\n\n\tJsonWriter wireJsonWriter(Wire);\n\n\tJsonWriter ethernetJsonWriter1(ethernetClient);\n\n\tJsonWriter ethernetJsonWriter2(ethernetServer);\n\n\nUsage\n------\n\n### Emit Primitives\n\n\twriter.string(\"Json String\");           // \"Json String\"\n\twriter.string(\"0x\" + String(255,HEX));  // \"0xFF\"\n\twriter.number(23);\t\t\t\t\t\t // 23\n\twriter.null();\t\t\t\t\t\t\t // null\n\twriter.boolean(true);\t\t\t\t\t // true\t\n\twriter.boolean(false);\t\t\t\t\t // false\n\n### Emit Array\n\twriter\n\t  .beginArray()\n\t  .string(\"alpha\")\n\t  .string(\"beta\")\n\t  .null()\n\t  .string(\"gamma\")\n\t  .number(123)\n\t  .endArray(); \t\t\t\t\t        \n\t  // [\"aplha\",\"beta\",null,\"gamma\",123]\n\n### Emit Object\n\twriter\n\t  .beginObject()\n            .property(\"Real name\",\"Thomas A. Anderson\")\n            .property(\"Hacker name\",\"Neo\")\n            .property(\"Entity\",\"The One\")\n            .property(\"Height\",185)\n            .property(\"isCreatedByArchitect\",true)\n\t  .endObject(); \n\t  \n\t  // {\"Real name\":\"Thomas A. Anderson\",\"Hacker name\":\"Neo\",\"Entity\":\"The One\",\"Height\":185,\"isCreatedByArchitect\":true}\n\t  \n### Array of objects\n\twriter\n\t  .beginArray()\n            .beginObject()\n                .property(\"name\", \"alpha\")\n            .endObject()\n            .beginObject()\n                .property(\"name\", \"beta\")\n                .property(\"anotherProperty\", 12.67)\n            .endObject()\n            .beginObject()\n                .property(\"name\", \"gamma\")\n            .endObject()\n\t  .endArray(); \t\t\t\t\t        \n\t  // [{\"name\":\"alpha\"},{\"name\":\"beta\",\"anotherProperty\":12.67},{\"name\":\"gamma\"}]\n\t  \n### Nested Objects and arrays\n\twriter\n\t  .beginObject()\n\t    .property(\"id\", 7)\n\t    .beginObject(\"name\")\n                .property(\"firstName\",\"James\")\n                .property(\"lastName\",\"Bond\")\n            .endObject()\n            .beginArray(\"languages\")\n                .string(\"English\")\n                .string(\"Russian\")\n            .endArray()\n            .beginArray(\"gadgets\")\n                .beginObject()\n                    .property(\"name\", \"Laser watch\")\n                    .property(\"returned\", false)\n                .endObject()\n                .beginObject()\n                    .property(\"name\", \"Walther PP\")\n                    .property(\"returned\", false)\n                    .beginArray(\"calibers\")\n                        .number(32)\n                        .number(380)\n                        .number(22)\n                    .endArray()\n                .endObject()\n            .endArray()\n\t  .endObject(); \n\t  \n\t  // {\"id\":7,\"name\":{\"firstName\":\"James\",\"lastName\":\"Bond\"},\"languages\":[\"English\",\"Russian\"],\"gadgets\":[{\"name\":\"Laser watch\",\"returned\":0},{\"name\":\"Walther PP\",\"returned\":0,\"calibers\":[32,380,22]}]}\n\t  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Farduinojsonwriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimnew%2Farduinojsonwriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Farduinojsonwriter/lists"}