{"id":17434623,"url":"https://github.com/mchalgarra/kml-to-json","last_synced_at":"2025-04-16T02:50:37.960Z","repository":{"id":45558412,"uuid":"421413709","full_name":"mchalgarra/kml-to-json","owner":"mchalgarra","description":"A library that contains methods to convert KML to JSON and JSON to KML.","archived":false,"fork":false,"pushed_at":"2022-11-03T03:07:10.000Z","size":191,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-22T13:37:54.525Z","etag":null,"topics":["javascript","json","kml","library","parser","typescript","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mchalgarra.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":"2021-10-26T12:22:31.000Z","updated_at":"2023-04-11T20:40:00.000Z","dependencies_parsed_at":"2023-01-21T11:46:26.187Z","dependency_job_id":null,"html_url":"https://github.com/mchalgarra/kml-to-json","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchalgarra%2Fkml-to-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchalgarra%2Fkml-to-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchalgarra%2Fkml-to-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchalgarra%2Fkml-to-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mchalgarra","download_url":"https://codeload.github.com/mchalgarra/kml-to-json/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249186842,"owners_count":21226792,"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":["javascript","json","kml","library","parser","typescript","web"],"created_at":"2024-10-17T09:07:58.958Z","updated_at":"2025-04-16T02:50:37.941Z","avatar_url":"https://github.com/mchalgarra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KML to JSON\n\n## About\n\nKML to JSON is a library made with Typescript that contains tools for KML files conversion.\n\n## Installing\n\nFirst, be sure to have [Node.js](https://nodejs.org/en/) installed.\n\nThen, install it by running:\n\n```bash\n$ npm install --save kml-to-json\n```\n\n## Usage\n\nThe library has 4 functions that may be used. They are:\n\n- ### kmlToJson\n\nIt converts a KML file to a JSON object, keeping all tags names, attributes, texts and children.\n\nReceives a file of the type `application/vnd.google-earth.kml+xml` or with the extension `kml`.\n\n\u003e It throws an error when the file type is incorrect.\n\nReturns an object containing all KML data with [this structure](#json-structure).\n\n```ts\nkmlToJson(file: File): Object\n```\n\n- ### kmlToJsonString\n\nIt converts a KML file to a JSON string, representing all tags names, attributes, texts and children.\n\nReceives a file of the type `application/vnd.google-earth.kml+xml` or with the extension `kml`.\n\n\u003e It throws an error when the file type is incorrect.\n\nReturns a string representing the KML data with [this structure](#json-structure).\n\n```ts\nkmlToJsonString(file: File): string\n```\n\n- ### jsonToKml\n\nIt converts a JSON object or string to a KML file.\n\nReceives an object or string with [this structure](#json-structure).\n\n\u003e It throws an error when the given parameter is not from type object or string.\n\nReturns a blob that represents the KML file. Its type is `application/vnd.google-earth.kml+xml`.\n\n```ts\njsonToKml(json: Object | string): Blob\n```\n\n- ### jsonToKmlString\n\nIt converts a JSON object or string to a structured KML string.\n\nReceives an object or string with [this structure](#json-structure).\n\n\u003e It throws an error when the given parameter is not from type object or string.\n\nReturns a string that represents the KML string structure.\n\n```ts\njsonToKmlString(json: Object | string): string\n```\n\n## JSON Structure\n\n```ts\n{\n  \"test-tag\": {\n    \"attributes\": {\n      \"attr1\": null,\n      \"attr2\": null,\n      \"class\": \"class-1\",\n      \"id\": \"test-tag\"\n    },\n    \"children\": {\n      \"child1\": {\n        \"attributes\": {},\n        \"order\": 0,\n        \"children\": {\n          \"child3\": {\n            \"attributes\": {\n              \"attr3\": null\n            },\n            \"children\": {\n              \"text0\": {\n                \"data\": \"Some text...\",\n                \"order\": 0\n              }\n            },\n            \"order\": 0,\n          }\n        }\n      },\n      \"child2\": {\n        \"attributes\": {},\n        \"order\": 1,\n        \"children\": {}\n      }\n    },\n    \"order\": 0,\n  }\n}\n```\n\n## License\n\nThe KmlToJson project is licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchalgarra%2Fkml-to-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmchalgarra%2Fkml-to-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchalgarra%2Fkml-to-json/lists"}