Giter VIP home page Giter VIP logo

json-viewer-problem's Introduction

JSON Viewer Problem

Example Usage

  • prettyjson -l response.json

Console Output

  • default behavior is to print pretty JSON which is indented and colorized.
  • General Command prettyjson [-r] [-l] [-h] [-v] [-nc] <file>
  • Options:
    • h: Show this help message.
    • v: Show version info.
    • r: Show raw Json file (as-is un-indented).
    • l: Print Line numbers in the output.
    • nc: Turn colorizing off.

Creating Eclipse and Idea Project files, Building and Running.

Using Java9 and above

  • To create project Eclipse Project files, run gradle -b build9.gradle eclipse
  • To create project Idea Project files, run gradle -b build9.gradle idea
  • To build the project execute gradle -b build9.gradle
  • To run the project execute gradle -b build9.gradle run

Using Eclipse Oxygen

Once the project is created, you need to add the following to configure it for using Java9:

  • Please refer to the link https://wiki.eclipse.org/Configure_Eclipse_for_Java_9
  • Add the following lines in your eclipse.ini file. --add-modules=ALL-SYSTEM after the vm property. Refer to www.journaldev.com/10882/eclipse-ini-vm-arguments-file-location-mac-windows for setting it up.
  • Start Eclipse
  • Next, we need to add the dependent jars (in our case, JSON jar, JCDP and Commons CLI) on the module path. So, go to Project properties, then go to Java Build Path, and under Classpath, expand the twisty for each jar that you want to be a module. You should see a new entry called "Is not modular". Click on it and click the Edit button. Under the Modular properties dialog that opens, check the box "Defines one or more modules". Click OK and it should now say "Is modular" and it will be moved up to Modulepath.

Using Pre-Java9

  • First delete the module-info.java present in the folder src/main/java
  • To create project Eclipse Project files, run gradle eclipse
  • To create project Idea Project files, run gradle idea
  • To build the project execute gradle
  • To run the project execute gradle run

Using Other languages like Scala, Groovy, Clojure

  • You can appropriately add the gradle plugins as per your choice of language in the build.gradle.
  • Do not forget to delete ```java`` plugin found therein.

Running

When you run this, it invokes, application main class, which just prints Json Viewer - Lets Begin Implementing!

Stories Slide Deck

Stories to be implemented are found on the Slideshare - Json Viewer

Project Dependencies

  • JSON Java - We will be using Java JSON library. If you need a primer on how to use this library, please refer to a short tutorial on http://www.baeldung.com/java-org-json. It can parse JSON text, produce JSON from Map, List and Java Objects (bean style) and can pretty print JSON as well. If you are comfortable with any other Java JSON library, please feel free to use it, but make sure, you update the project dependencies in build.gradle
  • Java Colored Debug Printer (JCDP) - has an easy syntax to print messages with a colored font/background on console (Win, MacOS and Linux based systems). Look here https://github.com/dialex/JCDP for the short primer and the documentation on ReadMe.md is quite sufficient for this project.
  • Optionally (though not required) you may want to use Apache Commons command line parsing library - Commons CLI. Here is how you can use it https://commons.apache.org/proper/commons-cli/usage.html

Releasing

  • Make sure, all your tests run, before releasing your solution.
  • It should not happen, that they run only on your machine ;)
  • A batch file prettyjson.bat for Windows and prettyjson for Linux based platforms must be included. By default, the gradle build produces these scripts. This will call Java and pass command line args to it.
  • NOTE: If you are using Java9, you need not do this, instead simply use JLink and produce a custom executable with the name prettyjson.

json-viewer-problem's People

Contributors

dhavaldalal avatar

Watchers

James Cloos avatar  avatar

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.