Json-parser - A parser for json-objects without dependencies

Overview

Json Parser

This is a experimental tool that I create for educational purposes, it's based in the jq works

With this tool you can parse json-like strings, and get some properties (like jq package)

Installation

To install json-parser first clone the repository:

mkdir -p ~/repo && cd ~/repo
git clone https://github.com/AlphaTechnolog/json-parser.git json-parser
cd json-parser

Then run the install.sh script:

sudo ./install.sh

Usage

You can parse json-like strings, passing it as a argument to json-parser like this:

json-parser '{"hello": "world"}'

It will print some output like this:

{ hello: 'world' }

And you can pass expressions as argument like this:

$ json-parser '{"hello": "world"}' '.hello'

It will print:

world

Because the expressions is a javascript accessor-like

Complex Usage

This is a more complex usage of the accessors

$ json-parser '{"hello": [0, [{"world": "hello"}]]}' '.hello[1][0].world'
hello

You can execute some javascript sentences in the expression, like this

$ json-parser '{"message": "You are "}' '.message + "beautiful"'
You are beautiful

Passing json-like strings from stdin

You can pass json-like strings from stdin, with commands like this:

$ echo '{"hello": "world"}' | jq > app.json
$ cat app.json | json-parser --stdin '.hello'
world

Or with a curl command:

$ curl http://localhost:8000/api/v1/todo/fetchall | json-parser --stdin '.todo[0]'
{
  name: "Go to the park",
  description: "I want to go to the park",
  completed: true
}

Enjoy

Thank you for read me, and thank you for use json-parser, if you like my work, please give me a star :)

You might also like...

JCS (JSON Canonicalization Scheme), JSON digests, and JSON Merkle hashes

JSON Hash This package contains the following JSON utilties for Deno: digest.ts provides cryptographic hash digests of JSON trees. It guarantee that d

Sep 2, 2022

Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

Mar 29, 2022

Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Jul 27, 2022

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

Instagram Without APIs Instagram Scraping in August 2022, no credentials required This is a Node.js library, are you looking for the same in PHP? go t

Dec 29, 2022

Find stale dependencies in the package.json file(s).

staledeps Find stale dependencies in the package.json file(s). Installation npm install -g staledeps Or simply using npx, the package runner bundled

Dec 15, 2022

A simple inefficient and buggy JSON parser written in JavaScript. Just a fun project

A simple inefficient and buggy JSON parser written in JavaScript. Just a fun project

A simple inefficient and buggy JSON parser written in JavaScript This JSON parser isn't guaranteed to work properly. Its recommended to use builtin JS

Feb 20, 2022

Jsonup - This is a zero dependency compile-time JSON parser written in TypeScript

jsonup This is a zero dependency compile-time JSON parser written in TypeScript.

Dec 8, 2022

A Svelte parser that compiles to Mitosis JSON, allowing you to write Svelte components once and compile to every framework.

Sveltosis Still in development A Svelte parser that compiles to Mitosis JSON, allowing you to write Svelte components once and compile to every framew

Nov 24, 2022

Hierarchical Converter for Array of Objects

Conversor Hierárquico para Array de Objetos - Hierarchical Converter to Array of Objects Docker-compose Cria a interface network e containers indicado

Jan 27, 2022
Owner
Gabriel Guerra
4 years of experience, 14 years, linux lover and fullstack developer.
Gabriel Guerra
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Binary-encoded serialization of JavaScript objects with generator-based parser and serializer

YaBSON Schemaless binary-encoded serialization of JavaScript objects with generator-based parser and serializer This library is designed to transfer l

Gildas 11 Aug 9, 2022
LiveJSON provides LiveView-like updating for JSON objects rather than DOM elements.

live_json LiveJSON provides LiveView-like updating for JSON objects rather than DOM elements. It works within your existing LiveViews - just use push_

Rich Jones 57 Dec 29, 2022
javascript library to convert a list of objects to a nested json output format, depending on the names in the list

formToNestedJson javascript "library" to convert a list of objects to a nested json output format, depending on the names in the list Basic usage Give

null 2 Aug 2, 2021
JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

Aykut Saraç 20.6k Jan 4, 2023
NodeJS library without any external dependencies to check if free HTTP/SOCKS4/SOCKS5 proxies are working/up

free-proxy_checker NodeJS library WITHOUT any external dependencies to: download free proxies; check if free HTTP/SOCKS4/SOCKS5 proxies are working/up

antoine vastel 15 Nov 6, 2022
Responsive navigation plugin without library dependencies and with fast touch screen support.

Responsive Nav Responsive navigation plugin without library dependencies and with fast touch screen support. Responsive Nav is a tiny JavaScript plugi

Viljami Salminen 4.1k Dec 29, 2022
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

file-upload-with-preview ?? Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well

John Datserakis 427 Dec 26, 2022
Simple scrollspy without jQuery, no dependencies

Simple Scrollspy Simple scrollspy is a lightweight javascript library without jQuery, no dependencies. It is used to make scrollspy effect for your me

Nguyen Huu Kim 57 Dec 13, 2022