PHPackages                             codegear/xml2json - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. codegear/xml2json

ActiveTool[Parsing &amp; Serialization](/categories/parsing)

codegear/xml2json
=================

Command-line tool to conver XML to JSON

1.0.0(7y ago)014GPL-3.0PHPPHP &gt;=7.0.0

Since Jan 29Pushed 6y agoCompare

[ Source](https://github.com/whitephp/xml2json)[ Packagist](https://packagist.org/packages/codegear/xml2json)[ Docs](https://github.com/whitephp/xml2json)[ RSS](/packages/codegear-xml2json/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

xml2json
========

[](#xml2json)

Command-line tool to convert XML to JSON

Requirements
------------

[](#requirements)

PHP needs to be a minimum version of PHP 7.0.0.

Installation
------------

[](#installation)

Globally by using [Composer](https://getcomposer.org/):

```
$ composer global require codegear/xml2json
```

Usage
-----

[](#usage)

### In Command-Line

[](#in-command-line)

Convert XML format data in file `data.xml` and output to screen:

```
$ xml2json data.xml
```

Convert XML format data in file `data.xml` and save to JSON file `data.json`:

```
$ xml2json data.xml > data.json
```

### In VIM

[](#in-vim)

Format current file:

```
:%!xml2json %
```

or add a keymap in `vimrc`:

```
nnoremap xj :%!xml2json %
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2667d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50379759?v=4)[whitePHP.net](/maintainers/whitephp)[@whitephp](https://github.com/whitephp)

---

Top Contributors

[![fanlei](https://avatars.githubusercontent.com/u/1195782?v=4)](https://github.com/fanlei "fanlei (1 commits)")

---

Tags

jsonformatter

### Embed Badge

![Health badge](/badges/codegear-xml2json/health.svg)

```
[![Health](https://phpackages.com/badges/codegear-xml2json/health.svg)](https://phpackages.com/packages/codegear-xml2json)
```

###  Alternatives

[justinrainbow/json-schema

A library to validate a json schema.

3.6k316.9M612](/packages/justinrainbow-json-schema)[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[ergebnis/json-printer

Provides a JSON printer, allowing for flexible indentation.

9138.2M24](/packages/ergebnis-json-printer)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30422.2M45](/packages/colinodell-json5)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
