All Projects → arakelian → Java Jq

arakelian / Java Jq

Licence: mit
Lightweight Java wrapper around JQ, a flexible JSON processor available for multiple platforms

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Java Jq

Node Jq
Node.js wrapper for jq
Stars: ✭ 147 (+297.3%)
Mutual labels:  json, jq
Oq
A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.
Stars: ✭ 132 (+256.76%)
Mutual labels:  json, jq
Yq
Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
Stars: ✭ 1,688 (+4462.16%)
Mutual labels:  json, jq
Jqview
simplest possible native GUI for inspecting JSON objects with jq
Stars: ✭ 355 (+859.46%)
Mutual labels:  json, jq
Emuto
manipulate JSON files
Stars: ✭ 180 (+386.49%)
Mutual labels:  json, jq
Json Splora
GUI for editing, visualizing, and manipulating JSON data
Stars: ✭ 1,818 (+4813.51%)
Mutual labels:  json, jq
Jqr
R interface to jq
Stars: ✭ 123 (+232.43%)
Mutual labels:  json, jq
Jackson Jq
jq for Jackson Java JSON Processor
Stars: ✭ 178 (+381.08%)
Mutual labels:  json, jq
Jq Web
jq in the browser with emscripten.
Stars: ✭ 188 (+408.11%)
Mutual labels:  json, jq
Aws
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
Stars: ✭ 493 (+1232.43%)
Mutual labels:  json, jq
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-13.51%)
Mutual labels:  json
Python Pixabay
Python 3 Pixabay's API wrapper.
Stars: ✭ 32 (-13.51%)
Mutual labels:  json
Realtime Newsapi
Financial News Aggregator - Real Time & Query API for Financial News
Stars: ✭ 34 (-8.11%)
Mutual labels:  json
Brutusin Rpc
Self-describing JSON-RPC web services over HTTP, with automatic API description based on JSON-Schema
Stars: ✭ 36 (-2.7%)
Mutual labels:  json
Borealis Server Manager
Utility designed to facilitate the deployment, management, and control of various kinds of dedicated gameservers.
Stars: ✭ 31 (-16.22%)
Mutual labels:  json
News Please
news-please - an integrated web crawler and information extractor for news that just works.
Stars: ✭ 969 (+2518.92%)
Mutual labels:  json
Jsonpath Rs
JSONPath for Rust
Stars: ✭ 31 (-16.22%)
Mutual labels:  json
Apicache
Simple API-caching middleware for Express/Node.
Stars: ✭ 957 (+2486.49%)
Mutual labels:  json
Json
Convenience wrapper for Foundation JSON.
Stars: ✭ 30 (-18.92%)
Mutual labels:  json
Json serializable.dart
Generates utilities to aid in serializing to/from JSON.
Stars: ✭ 979 (+2545.95%)
Mutual labels:  json

java-jq

java-jq is not a re-implementation of jq in Java; instead, it embeds the necessary jq and Oniguruma native libraries in a jar file, and then uses Java Native Access (JNA) to call the embedded libraries in a Java-friendly way.

The distribution of java-jq includes native JQ 1.6 libraries for all major platforms (Mac, Windows and Linux), and includes a statically linked version of Oniguruma 5.9.6 to avoid any runtime compatibility issues.

java-jq was heavily inspired by jjq.

Usage

Using Java-JQ is very easy.

First, let's get a reference to the Native JQ library. This class is a thread-safe singleton.

JqLibrary library = ImmutableJqLibrary.of();

Now, let's create a JQ request. A "request" is an immutable bean that contains three basic elements: a reference to the JQ library we created above, the JSON input you want to transform, and the JQ filter expression that you want to execute.

final JqRequest request = ImmutableJqRequest.builder() //
        .lib(library) //
        .input("{\"a\":[1,2,3,4,5],\"b\":\"hello\"}") //
        .filter(".") //
        .build();

As a final step, let's execute the request.

final JqResponse response = request.execute();
if( response.hasError ) {
   // display errors in response.getErrors()
} else {
   System.out.println( "JQ output: " + response.getOutput);
}

Compatibility

As of version 1.1.0, java-jq successfully executes the complete jq test suite, including all tests in jq.test, onig.test, base64.test, and optional.test.

java-jq supports modules as well. To use modules, include the directory paths where your modules can be found with your JqRequest as follows:

final JqRequest request = ImmutableJqRequest.builder() //
        .lib(library) //
        .input("your json goes here") //
        .filter(".") //
        .addModulePath(new File("/some/modules/can/be/found/here")) //
        .addModulePath(new File("/other/modules/can/be/found/here")) //
        .build();

Installation

The library is available on Maven Central.

Maven

Add the following to your pom.xml:

<repositories>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>http://repo.maven.apache.org/maven2</url>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

...

<dependency>
    <groupId>com.arakelian</groupId>
    <artifactId>java-jq</artifactId>
    <version>1.1.0</version>
    <scope>test</scope>
</dependency>

Gradle

Add the following to your build.gradle:

repositories {
  mavenCentral()
}

dependencies {
  testCompile 'com.arakelian:java-jq:1.1.0'
}

Licence

Apache Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].