{"id":15583334,"url":"https://github.com/nithin-sudarsan/data-mapper","last_synced_at":"2026-04-29T10:02:50.792Z","repository":{"id":178903524,"uuid":"660091162","full_name":"nithin-sudarsan/data-mapper","owner":"nithin-sudarsan","description":"Java library that offers a comprehensive solution for parsing, transforming, and mapping JSON or XML files to Java beans, driven by a given set of rules. ","archived":false,"fork":false,"pushed_at":"2023-08-12T06:59:11.000Z","size":16236,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main2","last_synced_at":"2025-06-11T15:38:48.527Z","etag":null,"topics":["java-library","java8","json","pojobuilder","xml"],"latest_commit_sha":null,"homepage":"https://datamapper-playground.netlify.app","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nithin-sudarsan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2023-06-29T08:16:30.000Z","updated_at":"2023-07-26T08:10:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"5951e2d2-c54d-4e11-8dc0-70953e25deef","html_url":"https://github.com/nithin-sudarsan/data-mapper","commit_stats":null,"previous_names":["nithin-sudarsan/data-mapper"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nithin-sudarsan/data-mapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nithin-sudarsan%2Fdata-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nithin-sudarsan%2Fdata-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nithin-sudarsan%2Fdata-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nithin-sudarsan%2Fdata-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nithin-sudarsan","download_url":"https://codeload.github.com/nithin-sudarsan/data-mapper/tar.gz/refs/heads/main2","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nithin-sudarsan%2Fdata-mapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["java-library","java8","json","pojobuilder","xml"],"created_at":"2024-10-02T20:07:08.573Z","updated_at":"2026-04-29T10:02:50.777Z","avatar_url":"https://github.com/nithin-sudarsan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Mapper - Java Library for JSON and XML Parsing\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nData Mapper is a powerful Java library that offers a comprehensive solution for parsing, transforming, and mapping JSON or XML files to Java beans, driven by a given set of rules. It is designed to simplify the process of data manipulation and conversion in your Java projects.\n\u003cbr\u003e\u003cbr\u003e With the latest version, Data Mapper introduces a new feature that allows seamless transformation of one Java bean to another type. Now, you can effortlessly convert your Java beans between different classes, making it even more versatile and adaptable to various data processing scenarios.\n\n## Table of Contents\n1. [ Features ](#features)\n2. [ Installation ](#installation)\n3. [ Methods Exposed ](#methods)\n4. [ Operations Supported ](#operations)\n5. [ Input File Structures ](#inputoutput)\n6. [ Contact ](#contact)\n\n\n\u003ca name=\"features\"\u003e\u003c/a\u003e\n## Features\n- Effortlessly parse JSON and XML files into Java beans.\n- Seamlessly transform JSON and XML strings into Java beans.\n- Preview the transformed JSON or XML as a string.\n- Flexibly transform one Java bean type into another using specified rules.\n- Transform data using custom rules to match specific requirements.\n- Exceptionally fast and lightweight for optimal performance.\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n## Installation\n\nTo use Data Mapper in your project, include the following dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.perfios\u003c/groupId\u003e\n    \u003cartifactId\u003edata-mapper\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003ca name=\"methods\"\u003e\u003c/a\u003e\n## Methods exposed\n### 1. `transformFile`\nTransforms a JSON or XML file according to specified rules and returns an instance of the desired class type. \u003cbr\u003eThe overloaded version of this method accepts JSON or XML along with the rules as `File` type to perform the same.\n#### Prameters expected\n\u003ctable style=\"border: none; width: 100%; padding: 0; margin: 0;\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003einputPath\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003e The path to the input file (JSON or XML) to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erulesPath\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003e The path to the rules file containing transformation rules.\u003c/td\u003e\n    \u003ctd rowspan=\"2\"\u003e\u003cb\u003e\u003ci\u003eclassName\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eClass\u0026lt;T\u0026gt;\u003c/code\u003e\u003cbr\u003e The desired class type to be returned after transformation.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003einput\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eFile\u003c/code\u003e\u003cbr\u003e The input JSON or XML file to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erules\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eFile\u003c/code\u003e\u003cbr\u003e The rules file containing transformation rules.\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Returns\nAn instance of the desired class type, representing the transformed data.\n\n#### Usage\n```java\nimport org.perfios.DataMapper;\nimport org.perfios.DataMapperImpl;\n\npublic class Usage\n{\n\tpublic static void main(String[] args) {\n\t\t// Create an instance of the DataMapper interface\n        DataMapper dataMapper = new DataMapperImpl();\n\n        // Specify the paths to the input JSON file and the rules file\n        String inputPath = \"/path/to/input.json\";\n        String rulesPath = \"/path/to/rules.txt\";\n        \n        // Define the desired Java bean class (Employee in this case)\n        Class\u003cEmployee\u003e desiredClass = Employee.class;\n\n        // Transform the JSON file using the specified rules and class type\n        Employee transformedEmployee = dataMapper.transformFile(inputPath, rulesPath, desiredClass);\n\t}\n}\n```\n\n### 2. `transformString`\nTransforms a JSON or XML string according to specified rules and returns an instance of the desired class type.\n#### Prameters expected\n\u003ctable style=\"border: none; width: 100%; padding: 0; margin: 0;\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003einputString\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e \u003cbr\u003e The JSON or XML string to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erulesString\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003e The string containing transformation rules.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003eclassName\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eClass\u0026lt;T\u0026gt;\u003c/code\u003e\u003cbr\u003e The desired class type to be returned after transformation.\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n#### Returns\nAn instance of the desired class type, representing the transformed data.\n\n#### Usage\n```java\nimport org.perfios.DataMapper;\nimport org.perfios.DataMapperImpl;\n\npublic class Usage\n{\n\tpublic static void main(String[] args) {\n\t\t// Create an instance of the DataMapper interface\n        DataMapper dataMapper = new DataMapperImpl();\n\n        // Specify the paths to the input JSON file and the rules file\n        String inputPath = \"/path/to/input.json\";\n        String rulesPath = \"/path/to/rules.txt\";\n        \n        // Read the contents of the input JSON file and rules file into strings\n        String inputString = new String(Files.readAllBytes(Paths.get(inputPath.getAbsolutePath())));\n        String rulesString = new String(Files.readAllBytes(Paths.get(rulesPath.getAbsolutePath())));\n       \n        \n        // Define the desired Java bean class (Employee in this case)\n        Class\u003cEmployee\u003e desiredClass = Employee.class;\n\n        // Transform the JSON file using the specified rules and class type\n        Employee transformedEmployee = dataMapper.transformString(inputString, rulesString, desiredClass);\n\t}\n}\n```\n\n### 3. `transformBean`\nTransforms an input Java Bean according to specified rules and returns another Java bean of the desired type. \u003cbr\u003eThe overloaded version of this method accepts the transformation rules as `File` type to perform the same.\n#### Prameters expected\n\u003ctable style=\"border: none; width: 100%; padding: 0; margin: 0;\"\u003e\n  \u003ctr\u003e\n    \u003ctd rowspan=\"2\"\u003e\u003cb\u003e\u003ci\u003einputBean\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eObject\u003c/code\u003e\u003cbr\u003eThe input Java bean to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erulesString\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003e The rules string containing transformation rules.\u003c/td\u003e\n    \u003ctd rowspan=\"2\"\u003e\u003cb\u003e\u003ci\u003eclassName\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eClass\u0026lt;T\u0026gt;\u003c/code\u003e\u003cbr\u003e The desired class type to be returned after transformation.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erules\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eFile\u003c/code\u003e\u003cbr\u003e The rules file containing transformation rules.\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Returns\nAn instance of the desired class type, representing the transformed data.\n\n#### Usage\n```java\nimport org.perfios.DataMapper;\nimport org.perfios.DataMapperImpl;\n\npublic class Usage\n{\n\tpublic static void main(String[] args) {\n\t\t// Create an instance of the DataMapper interface\n        DataMapper dataMapper = new DataMapperImpl();\n\n        // Specify the paths to the input Java bean and the rules file\n        EmployeeTypeA inputBean = new EmployeeTypeA(\"emp_id\",\"emp_name\",\"emp_salary\");\n        File rules= new File(\"/path/to/rules.txt\");\n        \n        // Define the desired Java bean class (Employee in this case)\n        Class\u003cEmployeeTypeB\u003e desiredClass = EmployeeTypeB.class;\n\n        // Transform the JSON file using the specified rules and class type\n        EmployeeTypeB transformedEmployee = dataMapper.transformFile(inputBean, rules, desiredClass);\n\t}\n}\n```\n\n### 4. `getTransformedString`\nTransforms an input JSON or XML string according to specified rules and returns a string representing the transformed input in the desired extension format. \u003cbr\u003eThe overloaded version of this method accepts JSON or XML along with the rules as `File` type to perform the same.\n#### Prameters expected\n\u003ctable style=\"border: none; width: 100%; padding: 0; margin: 0;\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003einput\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003eThe input JSON or XML string to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erules\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eString\u003c/code\u003e\u003cbr\u003e The rules string containing transformation rules.\u003c/td\u003e\n    \u003ctd rowspan=\"2\"\u003e\u003cb\u003e\u003ci\u003eext\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eDataMapperImpl.Extension\u003c/code\u003e\u003cbr\u003e The extension indicating the format of the input file (JSON or XML).\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003einput\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eFile\u003c/code\u003e\u003cbr\u003eThe input JSON or XML file to be transformed.\u003c/td\u003e\n    \u003ctd\u003e\u003cb\u003e\u003ci\u003erules\u003c/i\u003e\u003c/b\u003e \u003ccode\u003eFile\u003c/code\u003e\u003cbr\u003e The rules file containing transformation rules.\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Returns\nA string representing the transformed JSON or XML input in the desired extension format.\n\n#### Usage\n```java\nimport org.perfios.DataMapper;\nimport org.perfios.DataMapperImpl;\n\npublic class Usage\n{\n\tpublic static void main(String[] args) {\n\t\t// Create an instance of the DataMapper interface\n        DataMapper dataMapper = new DataMapperImpl();\n\n        //Create File objects of input file and rules file using their respective paths\n        File input = new File(\"/path/to/input.json\");\n        File rules = new File(\"/path/to/rules.txt\");\n\n        // Transform the JSON file using the specified rules and desired output type\n        String transformedEmployee = dataMapper.getTransformedString(input, rules, DataMapperImpl.Extension.XML);\n\t}\n}\n```\n\u003ca name=\"operations\"\u003e\u003c/a\u003e\n## Operations Supported\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ccode\u003e#add\u003c/code\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\"Facilitates addition of numbers or concatenation of two input fields.\"\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ccode\u003e#sub\u003c/code\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eFacilitates subtraction of numbers between two fields from input file\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ccode\u003e#mul\u003c/code\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eFacilitates multiplication of numbers between two fields from input file\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ccode\u003e#div\u003c/code\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eFacilitates division of numbers between two fields from input file\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003ccode\u003e#default\u003c/code\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eFacilitates setting default values for fields.\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ca name=\"inputoutput\"\u003e\u003c/a\u003e\n## Example Input File Structures and Output\n### JSON or XML input\n\u003ctable style=\"border: none; width: 100%; padding: 0; margin: 0;\"\u003e\n\u003ctr\u003e\n\t\u003ctd\u003eExample Input JSON File  \u003c/td\u003e\n\t\u003ctd\u003eExample Input XML File\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```json\n{\n  \"details\": {\t\t\t\n    \"name\": {\n      \"firstName\": \"John\",\n      \"lastName\": \"Doe\"\n    },\n    \"addresses\": [\n      {\n        \"address1\": {\n          \"phoneNumber\": 1234567890,\n          \"state\": \"California\"\n        }\n      },\n      {\n        \"address2\": {\n          \"phoneNumber\": 9876543210,\n          \"state\": \"New York\"\n        }\n      }\n    ]\n  }\n}\n\n```\n\u003c/td\u003e\n\u003ctd\u003e\n\n```xml\n\u003croot\u003e\n    \u003cdetails\u003e\n        \u003cname\u003e\n            \u003cfirstName\u003eJane\u003c/firstName\u003e\n            \u003clastName\u003eDoe\u003c/lastName\u003e\n\t\u003c/name\u003e\n\t\u003caddresses\u003e\n\t    \u003caddress1\u003e\n\t        \u003cphoneNumber\u003e5555555555\u003c/phoneNumber\u003e\n\t\t\u003cstate\u003eTexas\u003c/state\u003e\n\t    \u003c/address1\u003e\n\t\u003c/addresses\u003e\n\t\u003caddresses\u003e\n\t    \u003caddress2\u003e\n\t\t\u003cphoneNumber\u003e1234567890\u003c/phoneNumber\u003e\n\t\t\u003cstate\u003eWashington\u003c/state\u003e\n\t    \u003c/address2\u003e\n\t\u003c/addresses\u003e\n    \u003c/details\u003e\n\u003c/root\u003e\n\n```\n \n\u003c/td\u003e\t\n\u003c/tr\u003e\n\t\n\u003c/table\u003e\n\n### Example Rules File:\n\u003ci\u003erules.txt\u003c/i\u003e\n\u003ctable width=\"100%\"\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003ePersonalInfo/name\u003c/b\u003e = details/name/firstName #add details/name/lastName\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003ePersonalInfo/details\u003c/b\u003e = details/addresses[]/address1/state\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003ePersonalInfo/age\u003c/b\u003e = #default 25\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n### Output Java bean structure\n```java\n@AllArgsConstructor\n@NoArgsConstructor\n@Getter\n@Setter\npublic class PersonalInfo {\n    String name;\n    String age;\n    Object details;\n}\n```\n\u003ca name=\"contact\"\u003e\u003c/a\u003e\n## Contact\nIf you have any questions or feedback, feel free to reach out to us via [e-mail](mailto:nithinsudarsan740@gmail.com) .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnithin-sudarsan%2Fdata-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnithin-sudarsan%2Fdata-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnithin-sudarsan%2Fdata-mapper/lists"}