JSON Utilities
This module provides functions for processing JSON strings. It supports:
- Removing comments from JSON strings.
- Handling JSON configurations with comments.
Key Functions:
- strip_json_comments: Removes comments from a JSON string.
- check_escaped: Checks if a character is escaped (used internally by strip_json_comments).
Example:
std::string raw_json = R"({
"key": "value", // This is a comment
/* Another comment */
"key2": "value2"
})";
std::cout << "Clean JSON: " << clean_json << std::endl;
return 0;
}
Utilities for working with JSON strings, including removing comments.
std::string strip_json_comments(const std::string &json_string, bool with_whitespace=false, bool preserve_newlines=true)
Removes comments from a JSON string.