Giter Site home page Giter Site logo

jsonpp-rs's People

Contributors

brainmaestro avatar flo-l avatar mys721tx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jsonpp-rs's Issues

Feature request: adds an end break line (-w)

Hi.

Consider the following test:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}[user@host ~]$

Notice the output JSON doesn't contains an end empty line. With this new feature, it would allow to print as:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp <some-option-here>
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}
[user@host ~]$

The cURL tool contains a -w feature that is possible to do something like this:

[user@host ~]$ curl -s -w '\n' http://localhost:8080/fiscalidade/v1/version
{"status":"ok","result":{"major":0,"minor":6,"patch":2}}
[user@host ~]$ 

so, a good option to jsonpp tool could be:

[user@host ~]$ curl -s http://localhost:8080/fiscalidade/v1/version | jsonpp -w '\n'
{
  "status": "ok",
  "result": {
    "major": 0,
    "minor": 6,
    "patch": 2
  }
}
[user@host ~]$

WDYT?

Option to print comma at the beginning of the line

It would be cool to have an option for the formatter to print the comma at the beginning of the line. So instead of

{
  "key1": "value1",
  "key2": "value2"
}

it should print

{
  "key1": "value1"
  , "key2": "value2"
}

This would help when the file is version controlled because adding a new value in the first case would cause a 2 line diff while adding a value in the second case, would only cause a single line diff:

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

vs.

{
  "key1": "value1"
  , "key2": "value2"
  , "key3": "value3"
}

This is inspired by the format elm decided to use. Actually for better formatting, having the opening bracet and the first key/value pair in the same line would be nice to:

{ "key1": "value1"
, "key2": "value2"
}

You could implement a format optimized for version controll while still be human readable

Add Benchmarks

As Rust is so strong performance-wise it'd be cool to be among the fastest json pretty printers out there.

Maybe as a start three files with ~1Kb, ~1MB and ~1GB..

I'd accept a PR anytime!

Add optional color support

Json syntax highlighting would be a great addition to the library. One possibility is highlighting by default when stdout is a tty and no highlighting when stdout is a pipe or file. A --color flag could be used to override default behavior

Support files with line delimited json entries

While technically not a valid json file, I've come across many files where each line is a separate valid json object. jq is an example of a command line tool that handles this gracefully by parsing and processing each line in turn. It would be nice if pp_rs handled these types of files

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.