Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

args2json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

args2json

Define JSON using a list of strings (eg. command line arguments)

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

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 - https://github.com/tomnomnom/gron
  • catj - https://github.com/soheilpro/catj

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.

FAQs

Package last updated on 27 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc