args2json

0.0.3 • Public • Published

Overview

A node module for defining JSON from a list of string inputs. The main use case this library was designed for is command line input, but it will work in any scenario where the input is an array of strings.

Installation

npm install args2json

Example

const args2json = require('args2json');

args2json([
    'something[0].id=1',
    'something[0].name="Arnold"',
    'something[1].id=2',
    'something[1].name="Dwayne"',
])
// Returns:
//
//     {
//         "something": [
//             {
//                 "id": 1,
//                 "name": "Arnold"
//             }, {
//                 "id": 2,
//                 "name": "Dwayne"
//             }
//         ]
//     }
//

Similar projects

The projects below have similar designs around JSON input/output on the command line. However, neither of them are modules that can be used by another program.

Gron is the most similar to our syntax with its ability to build JSON via ungron, but it is only build for command line usage and it is written in Go.

Catj only implements the ability to output JSON to a path=value form, but not the other way.

Readme

Keywords

none

Package Sidebar

Install

npm i args2json

Weekly Downloads

1

Version

0.0.3

License

ISC

Unpacked Size

8.15 kB

Total Files

4

Last publish

Collaborators

  • brisebom