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

Add support for additional options to to_json_pretty #1055

Merged
merged 2 commits into from
Oct 15, 2019

Conversation

runejuhl
Copy link
Contributor

@runejuhl runejuhl commented Oct 9, 2019

This PR exposes all of the settings available in Ruby JSON.pretty_generate: https://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html#method-i-generate

Example:

to_json_pretty(['one', 'two', nil, 'three'], true, {'indent' => '@@@@'})
# [
# @@@@"one",
# @@@@"two",
# @@@@"three"
# ]

@runejuhl runejuhl requested a review from a team as a code owner October 9, 2019 19:29
This gives the ability to set e.g. indentation level and max nesting depth.
@michaeltlombardi michaeltlombardi merged commit c59b978 into puppetlabs:master Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants