PHPackages                             plepe/json-multiline-strings - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. plepe/json-multiline-strings

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

plepe/json-multiline-strings
============================

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

v0.1.0(8y ago)1236GPL-3.0PHP

Since Nov 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/plepe/json-multiline-strings)[ Packagist](https://packagist.org/packages/plepe/json-multiline-strings)[ Docs](https://github.com/plepe/json-multiline-strings)[ RSS](/packages/plepe-json-multiline-strings/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

json-multiline-strings
======================

[](#json-multiline-strings)

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

EXAMPLE
=======

[](#example)

Convert to multiline variant:

```
var input = {
    "foo": "bar",
    "long": "text with\nseveral\nline breaks"
}
console.log(JSON.stringify(jsonMultilineStrings.split(input), null, '    '))
{
    "foo": "bar",
    "long": [
        "text with",
        "several",
        "line breaks"
    ]
}
```

Convert back to original json:

```
var input = {
    "foo": "bar",
    "long": [
        "text with",
        "several",
        "line breaks"
    ]
}
console.log(JSON.stringify(jsonMultilineStrings.join(input), null, '    '))
{
    "foo": "bar",
    "long": "text with\nseveral\nline breaks"
}
```

API
===

[](#api)

jsonMultilineStrings.split(data, options) resp. jsonMultilineStringsSplit(data, options)
----------------------------------------------------------------------------------------

[](#jsonmultilinestringssplitdata-options-resp-jsonmultilinestringssplitdata-options)

Processes input data recursively and convert all multiline strings to string arrays.

Options:

- exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. \[ \[ 'foo', 'bar' \], \[ 'test' \] \]. This would not modify the paths 'foo/bar' and 'test'.

jsonMultilineStrings.join(data, options) resp. jsonMultilineStringsJoin(data, options)
--------------------------------------------------------------------------------------

[](#jsonmultilinestringsjoindata-options-resp-jsonmultilinestringsjoindata-options)

Processes input data recursively and convert all string arrays to multiline strings.

Options:

- exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. \[ \[ 'foo', 'bar' \], \[ 'test' \] \]. This would not modify the paths 'foo/bar' and 'test'.

INSTALL
=======

[](#install)

JS usage via npm
----------------

[](#js-usage-via-npm)

```
npm install --save json-multiline-strings
```

```
var jsonMultilineStrings = require('json-multiline-strings')
jsonMultilineStrings.split(...)
jsonMultilineStrings.join(...)
```

PHP usage via composer
----------------------

[](#php-usage-via-composer)

```
composer install plepe/json-multiline-strings
```

```
jsonMultilineStringsSplit(...)
jsonMultilineStringsJoin(...)
```

Development
-----------

[](#development)

```
git clone https://github.com/plepe/json-multiline-strings.git
cd json-multiline-strings
npm install
composer install
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

3109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c371961ca2ed98b3ec5320579d5d22900ab3ec9ccd40846516973d460586bc5?d=identicon)[plepe](/maintainers/plepe)

---

Top Contributors

[![plepe](https://avatars.githubusercontent.com/u/249012?v=4)](https://github.com/plepe "plepe (19 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/plepe-json-multiline-strings/health.svg)

```
[![Health](https://phpackages.com/badges/plepe-json-multiline-strings/health.svg)](https://phpackages.com/packages/plepe-json-multiline-strings)
```

###  Alternatives

[adfab/m2-module-gdpr

GDPR compatibility

632.2k](/packages/adfab-m2-module-gdpr)

PHPackages © 2026

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