-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Small question #1094
Comments
The pretty-printer is currently not so flexible. The set indentation is used for both objects and arrays. You can, however, set the indentation character to a tabs, see https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a5adea76fedba9898d404fef8598aa663.html#a5adea76fedba9898d404fef8598aa663 |
Thanks for your quick response ! |
I would like to discuss the interface first. Right now, the dump function already has 3 parameters, and I would like to avoid a complete bloat of parameters for use cases that are very rare. |
Yeah, I managed to modify it to get the result I wanted but the interface
got pretty ugly. I ended up simply removing the pretty print for arrays
because I like it better this way but this is just my personal taste :) I
agree with you, it's a rare use case and the modification required is
really small so it might not be such a good idea to change anything...
…On 17 May 2018 at 16:26, Niels Lohmann ***@***.***> wrote:
I would like to discuss the interface first. Right now, the dump function
already has 3 parameters, and I would like to avoid a complete bloat of
parameters for use cases that are very rare.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1094 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ALyKxtURXJY59eNuPo4XUh2Dkzfh0FwAks5tzYiXgaJpZM4UC0I9>
.
|
Hi,
Thanks for the library, it's really easy to setup and use :) I only have one small question :
Is it possible to set pretty print when printing a json object without setting it for arrays in the object ? I end up with
"obj1": {
"key1": "value1",
"key2": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
]
},
(there should be tabs but I couldn't get the code insertion to do what I want ^^')
which doesn't look very good.. Any way I can set the array to print in 1 line ? I could probably iterate thought each objects and check when there is an array and print it differenlty but that seems like a lot of work !
Thanks :)
The text was updated successfully, but these errors were encountered: