Skip to content

johanneshagspiel/haskell-jq-recreation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haskell JQ Clone Logo


BSD-3-License Top Language Latest Release

Haskell JQ Recreation

This repository contains a recreation of the JSON processor jq in Haskell.

Features

This recreation has implemented most of the functionality of jq such as as:

  • handling all valid JSON types including:
    • null
    • numbers (including floating-point and E-notation)
    • strings (with support for escape characters)
    • Booleans
    • Arrays
    • JSON Objects
  • applying all basic filters such as:
    • the identity filter .
    • parenthesis '()'
    • object indexing, both identifier .field and generic .["field"].
    • optional object indexing .field? (and .["field"]?)
    • the array index and slice .[0], .[0:10].
    • the array/object value iterator .[], .[1,2,3].
    • the optional counterparts for indexing, slicing and iterators
    • the comma operator op1 , op2
    • the pipe operator op1 | op2
  • simple and complex value constructors
  • handling conditionals and comparisons including:
    • "equal" and "not equal" operators ==, !=
    • if-then-else expressions if A then B else C end.
    • comparison operatorss for numbers <, <=, >, >=

Tools

Purpose Name
Programming language Haskell
Build tool Stack

Installation Process

It is assumed that an IDE such as Visual Studio Code is installed and that the users operating system is Windows.

  • Download and install the Haskell tool Stack
  • Open this repository in Visual Studio Code
  • Run the commands stack init, stack build and then stack install in the terminal

To run jq-clone, use echo <input.json> | jq-clone -- <filter> like in this example:

echo '{"this" : 2, "that" : 3}' | jq-clone '.this > .that'

Contributors

This template for this program was originally created by:

Licence

This JQ Haskell clone was originally published under the 3-Clause BSD License, which can be found in the LICENSE file. For this repository, the terms laid out there shall not apply to any individual that is currently enrolled at a higher education institution as a student. Those individuals shall not interact with any other part of this repository besides this README in any way by, for example cloning it or looking at its source code or have someone else interact with this repository in any way.

References

The jq logo was taken from the official jq website and the Haskell logo was taken from Wikipedia.

About

✂️ A recreation of the JSON processor jq in Haskell.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published