{"id":15579910,"url":"https://github.com/tyrasd/jxon","last_synced_at":"2025-09-21T23:43:22.629Z","repository":{"id":13082784,"uuid":"15763821","full_name":"tyrasd/jxon","owner":"tyrasd","description":"lossless JavaScript XML Object Notation","archived":false,"fork":false,"pushed_at":"2021-09-24T16:21:59.000Z","size":122,"stargazers_count":89,"open_issues_count":14,"forks_count":27,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-31T06:05:54.653Z","etag":null,"topics":["javascript","json","jxon","xml"],"latest_commit_sha":null,"homepage":"https://developer.mozilla.org/en-US/docs/JXON","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyrasd.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":"2014-01-09T10:35:32.000Z","updated_at":"2025-03-22T14:45:31.000Z","dependencies_parsed_at":"2022-08-31T00:00:36.944Z","dependency_job_id":null,"html_url":"https://github.com/tyrasd/jxon","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyrasd%2Fjxon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyrasd%2Fjxon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyrasd%2Fjxon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyrasd%2Fjxon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyrasd","download_url":"https://codeload.github.com/tyrasd/jxon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247633894,"owners_count":20970413,"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","jxon","xml"],"created_at":"2024-10-02T19:21:43.227Z","updated_at":"2025-09-21T23:43:17.561Z","avatar_url":"https://github.com/tyrasd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"JXON [![Build Status](https://secure.travis-ci.org/tyrasd/jxon.svg)](https://travis-ci.org/tyrasd/jxon)\n====\n\nA complete, bidirectional, JXON (lossless JavaScript XML Object Notation) library. Packed as UMD.\n\nImplementation of Mozilla's [JXON](https://developer.mozilla.org/en-US/docs/JXON) code. Head over to MDN for [Documentation](https://developer.mozilla.org/en-US/docs/JXON#Usage).\n\n\n#### Example:\n\n```js\n{name: 'myportal'} \n\u003cname\u003emyportal\u003c/name\u003e\n\n{user: {\n    username: 'testUser1',\n    password: 'yolo',\n    enabled: true\n}}\n\u003cuser\u003e\n  \u003cusername\u003etestUser1\u003c/username\u003e\n  \u003cpassword\u003eyolo\u003c/password\u003e\n  \u003cenabled\u003etrue\u003c/enabled\u003e\n\u003c/user\u003e\n\n{tag: {\n    $type: 'regular'\n    $blacklist: false\n    _: 'Backbase'\n}}\n\u003ctag type=\"regular\" blacklist=\"false\"\u003eBackbase\u003c/tag\u003e\n\n{dogs: {\n    name: ['Charlie', {$nick: 'yes', _:'Mad Max'}]\n}}\n\u003cdogs\u003e\n    \u003cname\u003eCharlie\u003c/name\u003e\n    \u003cname nick=\"yes\"\u003eMad Max\u003c/name\u003e\n\u003c/dogs\u003e\n```\n\n# API\n\n### .config(cnf)\n**Overrides default configuration properties**\n- cnf - Object with configuration properties.\n\n_Defaults:_\n\n```js\nvalueKey: '_',\nattrKey: '$',\nattrPrefix: '$',\nlowerCaseTags: false,\ntrueIsEmpty: false,\nautoDate: false,\nignorePrefixedNodes: false,\nparseValues: false,\nparserErrorHandler: undefined\n```\n\n### .stringToJs(xmlString)\n**Converts XML string to JS object.**\n- xmlString - XML string to convert to JXON notation JS object\n\n### .jsToString(obj)\n**Converts JS object to XML string.**\n- obj - JS object in JXON notation to convert to XML string\n\n### .xmlToJs(xmlDocument, verbosity, freeze, nestedAttributes)\n**Converts XML document to JS object. _Alias: JXON.build_**\n- xmlDocument - The XML document to be converted into JavaScript Object.\n- verbosity - Optional verbosity level of conversion, from 0 to 3. It is almost equivalent to our algorithms from #4 to #1 (default value is 1, which is equivalent to the algorithm #3).\n- freeze - Optional boolean expressing whether the created object must be freezed or not (default value is false).\n- nestedAttributes - Optional boolean expressing whether the the nodeAttributes must be nested into a child-object named keyAttributes or not (default value is false for verbosity levels from 0 to 2; true for verbosity level 3).\n \nExample:\n```js\nvar myObject = JXON.build(xmlDoc);\n```\n### .jsToXml(obj, namespaceURI, qualifiedNameStr, documentType)\n**Converts JS object to XML document. _Alias: JXON.unbuild_**\n- obj - The JavaScript Object from which you want to create your XML Document.\n- namespaceURI - Optional DOMString containing the namespace URI of the document to be created, or null if the document doesn't belong to one.\n- qualifiedNameStr - Optional DOMString containing the qualified name, that is an optional prefix and colon plus the local root element name, of the document to be created.\n- documentType - Optional DocumentType of the document to be created. It defaults to null.\n \nExample:\n```js\nvar myObject = JXON.unbuild(myObject);\n```\n\n### .stringToXml(xmlString)\n**Wrapper over DOMParser.parseFromString, converts string to XML document.**\n- xmlString - XML string to convert to XML document\n\n### .xmlToString(xmlObj)\n**Wrapper over XMLSerializer.serializeToString, converts XML document to string.**\n- xmlObj - XML document to convert to XML string\n\n### .each(obj, callback[, thisArg])\n**Helper method to iterate node(s).**  \nIn case that there is only one children node, JXON will return object. For multiple children it will return array. This method will always iterate nodes as array.\n- obj - array or object to iterate\n- callback - function to execute for each element\n- thisArg - optional. Value to use as this when eecuting callback\n\nExample:\n```js\nvar jx = jxon.stringToJs('\u003cval\u003efoo\u003c/val\u003e');\njxon.each(jx.val, function(val) {\n    assert(val, 'foo');\n});\n```\n\n# CHANGELOG\n\n## 2.0.0\n\nchanges from version 1.x to 2.0 include:\n\n* (breaking) more usefull default settings (see above)\n* (breaking) stringify Dates to ISO format instead of GMT\n* improved xml namespace handling on node and browsers\n* renamed main source file to `jxon.js`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyrasd%2Fjxon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyrasd%2Fjxon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyrasd%2Fjxon/lists"}