Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RsPrettyJson only support json objects #1299

Open
laeubi opened this issue Jun 10, 2024 · 0 comments
Open

RsPrettyJson only support json objects #1299

laeubi opened this issue Jun 10, 2024 · 0 comments

Comments

@laeubi
Copy link

laeubi commented Jun 10, 2024

If one returns a JSON Array and try to pretty print it there is an error:

java.io.IOException: javax.json.stream.JsonParsingException: JsonParser#getObject() or JsonParser#getObjectStream() is valid only for START_OBJECT parser state. But current parser state is START_ARRAY
	at org.takes.rs.RsPrettyJson.transform(RsPrettyJson.java:117)
	at org.takes.rs.RsPrettyJson.make(RsPrettyJson.java:92)
	at org.takes.rs.RsPrettyJson.head(RsPrettyJson.java:74)
	at org.takes.rs.RsWrap.head(RsWrap.java:58)
	at org.takes.rs.RsPrint.printHead(RsPrint.java:132)
	at org.takes.rs.RsPrint.print(RsPrint.java:117)
	at org.takes.http.BkBasic.print(BkBasic.java:123)
	at org.takes.http.BkBasic.accept(BkBasic.java:99)
	at org.takes.http.BkSafe.lambda$new$0(BkSafe.java:46)
	at org.takes.http.BkWrap.accept(BkWrap.java:51)
	at org.takes.http.FtBasic.loop(FtBasic.java:113)
	at org.takes.http.FtBasic.start(FtBasic.java:99)

beside that it would be useful if one can pass directly a JsonStructure to avoid the additional parsing of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant