JsonParser

The library performs an operation on JSON and returns CSV data in the following output formats: String, File, and Writer.

License

License

Categories

Categories

JSON Data
GroupId

GroupId

com.github.ramalapure
ArtifactId

ArtifactId

json-parser
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

JsonParser
The library performs an operation on JSON and returns CSV data in the following output formats: String, File, and Writer.
Project URL

Project URL

https://github.com/RamAlapure/jsonparser
Source Code Management

Source Code Management

https://github.com/RamAlapure/jsonparser

Download json-parser

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.ramalapure/json-parser/ -->
<dependency>
    <groupId>com.github.ramalapure</groupId>
    <artifactId>json-parser</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.ramalapure/json-parser/
implementation 'com.github.ramalapure:json-parser:1.1'
// https://jarcasting.com/artifacts/com.github.ramalapure/json-parser/
implementation ("com.github.ramalapure:json-parser:1.1")
'com.github.ramalapure:json-parser:jar:1.1'
<dependency org="com.github.ramalapure" name="json-parser" rev="1.1">
  <artifact name="json-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.ramalapure', module='json-parser', version='1.1')
)
libraryDependencies += "com.github.ramalapure" % "json-parser" % "1.1"
[com.github.ramalapure/json-parser "1.1"]

Dependencies

runtime (4)

Group / Artifact Type Version
org.apache.metamodel : MetaModel-core jar 5.3.0
org.apache.metamodel : MetaModel-csv jar 5.3.0
com.google.code.gson : gson jar 2.8.6
com.jayway.jsonpath : json-path jar 2.4.0

Project Modules

There are no modules declared in this project.

The library perform operation on json and returns csv data in multiple output formats:

  1. String
  2. File
  3. Writer

How you can use it:

Maven Central

Maven

<dependency>
  <groupId>com.github.ramalapure</groupId>
  <artifactId>json-parser</artifactId>
  <version>1.1</version>
</dependency>

Gradle

implementation 'com.github.ramalapure:json-parser:1.1'

To parse json input string to csv, you can do it by following ways:

Note: The following default separator "_" and delimiter "," are used while creating CSV.
Also there is an alternative to pass custom separator (e.g. "/") and delimiter(e.g. "|").

  1. Output as String

    JsonParser.parse2Csv(INPUT_JSON_STRING); 
    // or
    JsonParser.parse2Csv(INPUT_JSON_STRING, CUSTOM_SEPARATOR, CUSTOM_DELIMITER);
    
  2. Output as Writer

    JsonParser.parse2Csv(INPUT_JSON_STRING, WRITER_OBJECT); //e.g. StringWriter, FileWriter, etc.
    // or
    JsonParser.parse2Csv(INPUT_JSON_STRING, WRITER_OBJECT, CUSTOM_SEPARATOR, CUSTOM_DELIMITER);
    
  3. Output as File

    JsonParser.parse2Csv(INPUT_JSON_STRING, CSV_FILE_PATH); // CSV_FILE_PATH e.g. test.csv or D://somefolder/test.csv or /home/user/downloads/test.csv
    // or
    JsonParser.parse2Csv(INPUT_JSON_STRING, CSV_FILE_PATH, CUSTOM_SEPARATOR, CUSTOM_DELIMITER);
    

Versions

Version
1.1
1.0