Coder Social home page Coder Social logo

oj's Introduction

OJ - Output JSON

OJ, short for Output JSON, is a powerful and flexible Command Line Interface (CLI) utility designed to convert the output of various Linux commands into a structured JSON format. This utility is particularly useful for system administrators, developers, and DevOps professionals who often need to parse and manipulate command-line output for scripting, automation, or monitoring purposes.

Features

  • Supports a wide range of Linux commands.
  • Handles different output formats using various parsers.
  • Extensible design allows for adding custom parsers.
  • Converts command-line output to JSON.

Usage

OJ can be used with any command that produces output. Simply pipe the command's output into OJ and specify the appropriate parser with the -p flag. If no parser is specified, OJ uses a default parser.

command | oj -p parser

In the following example, the KeyValueParser (kv) is used to parse the output of the ls -l command.

ls -l | oj -p kv

And to parse the output of the printenv command, you can use the following command:

printenv | oj

Available Parsers

OJ comes with a set of built-in parsers:

  • default: Parses key-value pairs separated by an equals sign.
  • kv: Parses key-value pairs separated by a custom separator.
  • csv: Converts CSV data into JSON.
  • yaml: Converts YAML data into JSON.
  • xml: Converts XML data into JSON.
  • log: Parses common log formats.

Building

OJ requires the Go compiler version 1.17 or later. You can use the provided Makefile to compile the project:

make build

This will produce an executable named oj in the bin directory.

oj's People

Contributors

jalmeida1994 avatar lmmendes avatar

Watchers

 avatar  avatar  avatar

Forkers

jalmeida1994

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.