Skip to content

Commit

Permalink
Use pqrs::json::pqrs_formatter::format
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Jun 22, 2024
1 parent bb1268d commit ae2a3c5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/share/json_utility.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <nlohmann/json.hpp>
#include <pqrs/json.hpp>

namespace krbn {
namespace json_utility {
Expand All @@ -26,10 +27,17 @@ inline nlohmann::json parse_jsonc(T first, T last) {
}

inline std::string dump(const nlohmann::json& json) {
return json.dump(4,
' ',
false,
nlohmann::json::error_handler_t::ignore);
return pqrs::json::pqrs_formatter::format(
json,
{.indent_size = 4,
.error_handler = nlohmann::json::error_handler_t::ignore,
.force_multi_line_array_object_keys = {
"bundle_identifiers",
"game_pad_stick_horizontal_wheel_formula",
"game_pad_stick_vertical_wheel_formula",
"game_pad_stick_x_formula",
"game_pad_stick_y_formula",
}});
}
}; // namespace json_utility
} // namespace krbn

0 comments on commit ae2a3c5

Please sign in to comment.