Git Product home page Git Product logo

Comments (9)

turadg avatar turadg commented on September 25, 2024

I just noticed that you said in #1 that you won't support newlines in JSON. That at least seems worth documenting, and perhaps including in the error message.

(Note I'm using the Homebrew version, which doesn't has an empty --help:

Usage of jsonpp:

from jsonpp.

aubergene avatar aubergene commented on September 25, 2024

I had this issue too. Accepting newlines or giving a better error message would be great

from jsonpp.

spig avatar spig commented on September 25, 2024

I also get an empty help message with --help (using homebrew) and I think it would be nice to take already pretty json and keep it that way. I would like to be able to keep my json file pretty even though I'm still modifying it and not have to put everything on one line. If this is a feature that you'd support I'd be glad to help contribute back.

from jsonpp.

robertkrimen avatar robertkrimen commented on September 25, 2024

Yeah, I think in its current state the behavior is broken.

Piping in already pretty (or non-crunched) JSON via stdin results in an error... pretty unexpected...

from jsonpp.

wader avatar wader commented on September 25, 2024

I just run into this also. Is there a good reason for parsing each line instead of the whole input? The only use case i can come up with is indenting output where each line is a separate JSON string.

A workaround is to replace new lines, e.g:

curl ... | tr "\n" " " | jsonpp

from jsonpp.

Vramin avatar Vramin commented on September 25, 2024

Just went through the same exercise this afternoon, every file I tried to parse exited with:

ERROR: Broken json on line 1, char 2: unexpected end of JSON input
Context: {

Went back to jsonlint which thinks my JSON is just dandy.

It's documented, but it still seems like an odd behavior.

from jsonpp.

wader avatar wader commented on September 25, 2024

For people ending up here: try the program jq, e.g. cat file.json | jq .

from jsonpp.

da-mobenga avatar da-mobenga commented on September 25, 2024

@wader, thanks

from jsonpp.

wader avatar wader commented on September 25, 2024

@da-mobenga 👍

from jsonpp.

Related Issues (12)

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.