{"id":22822677,"url":"https://github.com/smooks/smooks-json-cartridge","last_synced_at":"2025-04-14T01:55:13.112Z","repository":{"id":37942408,"uuid":"247531610","full_name":"smooks/smooks-json-cartridge","owner":"smooks","description":"Smooks JSON Cartridge","archived":false,"fork":false,"pushed_at":"2025-03-31T22:57:20.000Z","size":181,"stargazers_count":1,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T01:55:05.321Z","etag":null,"topics":["json","json-to-xml","smooks-cartridge"],"latest_commit_sha":null,"homepage":"https://www.smooks.org/documentation/#json","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smooks.png","metadata":{"files":{"readme":"README.adoc","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}},"created_at":"2020-03-15T18:57:24.000Z","updated_at":"2025-01-31T09:27:44.000Z","dependencies_parsed_at":"2024-04-22T23:37:39.020Z","dependency_job_id":null,"html_url":"https://github.com/smooks/smooks-json-cartridge","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooks%2Fsmooks-json-cartridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooks%2Fsmooks-json-cartridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooks%2Fsmooks-json-cartridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooks%2Fsmooks-json-cartridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smooks","download_url":"https://codeload.github.com/smooks/smooks-json-cartridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809032,"owners_count":21164895,"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":["json","json-to-xml","smooks-cartridge"],"created_at":"2024-12-12T16:12:59.584Z","updated_at":"2025-04-14T01:55:13.078Z","avatar_url":"https://github.com/smooks.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Smooks JSON Cartridge\n\nimage:https://img.shields.io/maven-central/v/org.smooks.cartridges/smooks-json-cartridge[Maven Central]\nimage:https://img.shields.io/nexus/s/org.smooks.cartridges/smooks-json-cartridge?server=https%3A%2F%2Foss.sonatype.org[Sonatype Nexus (Snapshots)]\nimage:https://github.com/smooks/smooks-json-cartridge/workflows/CI/badge.svg[Build Status]\nimage:https://img.shields.io/badge/group-user-red?logo=Gmail[email group,link=https://groups.google.com/g/smooks-user]\nimage:https://img.shields.io/badge/group-dev-red?logo=Gmail[email group,link=https://groups.google.com/g/smooks-dev]\nimage:https://img.shields.io/badge/chat-on%20gitter-46bc99.svg[Gitter chat,link=https://gitter.im/smooks/smooks]\n\n// tag::smooks-json-cartridge[]\nProcessing JSON with Smooks requires a JSON reader to be configured:\n\n.smooks-config.xml\n[source,xml]\n----\n\u003c?xml version=\"1.0\"?\u003e  \n\u003csmooks-resource-list xmlns=\"https://www.smooks.org/xsd/smooks-2.0.xsd\"\n                      xmlns:json=\"https://www.smooks.org/xsd/smooks/json-1.3.xsd\"\u003e  \n\n    \u003cjson:reader/\u003e  \n\n\u003c/smooks-resource-list\u003e\n----\n\nThe XML element name of the root element, the element name of document and the element name of array elements can be configured with the following configuration options:\n\n* `+rootName+`: The name of the root element. Default: `+json+`.\n* `+arrayElementName+`: The name of a sequence element. Default: `+element+`.\n\nJSON allows characters in the key name that aren't allowed in XML element name. To workaround that problem the reader offers multiple solutions. The JSON reader can search and replace whitespaces, illegal characters and the number in key names that start with a number. It is also possible to replace one key name with a completely different name. The following example demonstrates all these features:\n\n.smooks-config.xml\n[source,xml]\n----\n\u003c?xml version=\"1.0\"?\u003e  \n\u003csmooks-resource-list xmlns=\"https://www.smooks.org/xsd/smooks-2.0.xsd\"\n                      xmlns:json=\"https://www.smooks.org/xsd/smooks/json-1.3.xsd\"\u003e  \n\n    \u003cjson:reader keyWhitspaceReplacement=\"_\" keyPrefixOnNumeric=\"n\" illegalElementNameCharReplacement=\".\"\u003e  \n        \u003cjson:keyMap\u003e  \n            \u003cjson:key from=\"some key\"\u003esomeKey\u003c/json:key\u003e  \n            \u003cjson:key from=\"some\u0026amp;key\" to=\"someAndKey\"/\u003e  \n        \u003c/json:keyMap\u003e  \n    \u003c/json:reader\u003e  \n\n\u003c/smooks-resource-list\u003e\n----\n\n* `+keyWhitspaceReplacement+`: The replacement character for whitespaces in a json map key. By default this not defined, so that the reader doesn't search for white spaces.\n* `+keyPrefixOnNumeric+`: The prefix character to add if the JSON node name starts with a number. By default this is not defined, so that the reader doesn't search for element names that start with a number.\n* `+illegalElementNameCharReplacement+`: If illegal characters are encountered in a JSON element name then they are replaced with this value.\n\nThe following options can also be configured on the JSON reader:\n\n* `+nullValueReplacement+`: The replacement string for JSON NULL values.\nDefault is an empty string.\n* `+encoding+`: The default encoding of any JSON message InputStream\nprocessed by this Reader. Default of 'UTF-8'. \n\nNOTE: You shouldn't need this configuration parameter and *it will be removed in a future release*. Instead, you should manage the JSON stream Source character encoding by supplying a `+java.io.Reader+` to the `+Smooks.filterSource()+` method.\n\n== Java API\n\nSmooks is programmatically configured to read a JSON configuration using the link:/javadoc/v1.7.1/smooks/org/milyn/json/JSONReaderConfigurator.html[JSONReaderConfigurator]\nclass.\n\n[source,java]\n----\nSmooks smooks = new Smooks();  \n\nsmooks.setReaderConfig(new JSONReaderConfigurator()  \n        .setRootName(\"root\")  \n        .setArrayElementName(\"e\"));  \n\n// Use Smooks as normal...\n...\n----\n\n== Maven Coordinates\n\n.pom.xml\n[source,xml]\n----\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.smooks.cartridges\u003c/groupId\u003e\n    \u003cartifactId\u003esmooks-json-cartridge\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.3\u003c/version\u003e\n\u003c/dependency\u003e    \n----\n\n== XML Namespace\n\n....\nxmlns:json=\"https://www.smooks.org/xsd/smooks/json-1.3.xsd\"\n....\n// end::smooks-json-cartridge[]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmooks%2Fsmooks-json-cartridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmooks%2Fsmooks-json-cartridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmooks%2Fsmooks-json-cartridge/lists"}