{"id":19460440,"url":"https://github.com/3tty0n/play-json-xml","last_synced_at":"2025-04-25T07:33:13.971Z","repository":{"id":57739570,"uuid":"86478804","full_name":"3tty0n/play-json-xml","owner":"3tty0n","description":"Converting between play-json and xml like json4s.","archived":false,"fork":false,"pushed_at":"2019-09-08T07:48:20.000Z","size":59,"stargazers_count":10,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-07-07T06:37:57.707Z","etag":null,"topics":["json","play-json","scala","xml"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3tty0n.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":"2017-03-28T15:48:59.000Z","updated_at":"2023-07-07T06:37:57.707Z","dependencies_parsed_at":"2022-09-02T14:32:12.295Z","dependency_job_id":null,"html_url":"https://github.com/3tty0n/play-json-xml","commit_stats":null,"previous_names":[],"tags_count":8,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3tty0n%2Fplay-json-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3tty0n%2Fplay-json-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3tty0n%2Fplay-json-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3tty0n%2Fplay-json-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3tty0n","download_url":"https://codeload.github.com/3tty0n/play-json-xml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223989877,"owners_count":17237168,"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","play-json","scala","xml"],"created_at":"2024-11-10T17:37:09.853Z","updated_at":"2024-11-10T17:37:10.890Z","avatar_url":"https://github.com/3tty0n.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# play-json-xml\n\n[![Build Status](https://travis-ci.org/3tty0n/play-json-xml.svg?branch=master)](https://travis-ci.org/3tty0n/play-json-xml) \n[![Maven Central](https://img.shields.io/maven-central/v/org.micchon/play-json-xml_2.12.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.micchon%22%20AND%20a:%22play-json-xml_2.12%22)\n\n\nIt converts between play-json and xml like json4s.\n\n## Install\n\nBuilds are available for 2.12.x and for 2.13.x. The main line of development of play-json-xml is 2.12.4.\n\n```scala\nlibraryDependencies += \"org.micchon\" %% \"play-json-xml\" % \"(version)\"\n```\n\n## Useage\n\nIf you want to convert xml to json,\n\n```scala\nimport play.api.libs.json.Xml\nimport play.api.libs.json.implicits._\nimport play.api.libs.json.Json\n\nimport scala.xml._\n\nval xml =\n  \u003cmoney\u003e\n    \u003cyen\u003e\n      \u003cprice\u003e100\u003c/price\u003e\n    \u003c/yen\u003e\n    \u003cdol\u003e\n      \u003cprice\u003e110\u003c/price\u003e\n    \u003c/dol\u003e\n  \u003c/money\u003e\n\nXml.toJson(xml) == // or xml.toJson\n  JsObject(Seq(\n    \"money\" -\u003e JsObject(Seq(\n      \"yen\" -\u003e JsObject(Seq(\"price\" -\u003e JsNumber(100))),\n      \"dol\" -\u003e JsObject(Seq(\"price\" -\u003e JsNumber(110)))\n    ))\n  ))\n```\n\nOr, if you want to convert json to xml,\n\n```scala\nimport play.api.libs.json.Xml\nimport play.api.libs.json.implicits._\nimport play.api.libs.json.Json\n\nval json = Json.parse(\n  \"\"\"\n    |{\n    |   \"fruits\":{\n    |      \"fruit\":[\n    |         {\n    |            \"name\":\"banana\",\n    |            \"price\":1000,\n    |            \"season\":true,\n    |            \"delicious\":true\n    |         },\n    |         {\n    |            \"name\":\"strowberry\",\n    |            \"price\":3000,\n    |            \"season\":false,\n    |            \"delicious\":true\n    |         }\n    |      ]\n    |   }\n    |}\n  \"\"\".stripMargin)\n\nXml.toXml(json) == // or json.toXml\n  \u003cfruits\u003e\u003cfruit\u003e\u003cname\u003ebanana\u003c/name\u003e\u003cprice\u003e1000\u003c/price\u003e\u003cseason\u003etrue\u003c/season\u003e\u003cdelicious\u003etrue\u003c/delicious\u003e\u003c/fruit\u003e\u003cfruit\u003e\u003cname\u003estrowberry\u003c/name\u003e\u003cprice\u003e3000\u003c/price\u003e\u003cseason\u003efalse\u003c/season\u003e\u003cdelicious\u003etrue\u003c/delicious\u003e\u003c/fruit\u003e\u003c/fruits\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3tty0n%2Fplay-json-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3tty0n%2Fplay-json-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3tty0n%2Fplay-json-xml/lists"}