https://github.com/semlabs/json_to_xml
Convert json to xml written in Elixir
https://github.com/semlabs/json_to_xml
converter elixir elixir-lang hex json xml
Last synced: 11 months ago
JSON representation
Convert json to xml written in Elixir
- Host: GitHub
- URL: https://github.com/semlabs/json_to_xml
- Owner: semlabs
- License: mit
- Created: 2017-05-22T13:52:15.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-05T13:54:52.000Z (over 8 years ago)
- Last Synced: 2025-06-22T14:56:48.740Z (12 months ago)
- Topics: converter, elixir, elixir-lang, hex, json, xml
- Language: Elixir
- Size: 17.6 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JsonToXml
[](https://semaphoreci.com/semlabs/json_to_xml)
[](https://hex.pm/packages/json_to_xml)
[](https://github.com/semlabs/json_to_xml)
Convert JSON strings to XML.
## Installation
The package can be installed by adding `json_to_xml` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:json_to_xml, "~> 0.4.0"}]
end
```
## Usage
After adding the dependency you can use the converter like this:
```elixir
JsonToXml.convert!(~s({ "name": "John" }))
#=> "\n\n\tJohn\n"
```
To convert files use `convertFile`:
```elixir
JsonToXml.convertFile!("/path/to/file")
```
## Documentation
The docs can be found at [https://hexdocs.pm/json_to_xml](https://hexdocs.pm/json_to_xml).
## Known issues
- JSON with empty keys is not supported and leads to an empty XML tag:
JSON:
```json
{
"": "content
}
```
XML:
```xml
<>content>
```