mirror of
https://github.com/json-c/json-c.git
synced 2026-03-31 10:59:06 +08:00
add JSON_C_TO_STRING_COLOR option
This option enable color in json_object_to_json_string_ext. I've try to made something similar to jq output, but I've color true/false and null in purple, as it's what is common color scheme used in programing language in emacs. also add a '-c' option into json_parser to test it. note: that I could have done a color() function similar to what is done with indent(), but as the code is pretty small I've keep it as it. so if you want me to use a subfunction tell me and I'll do it. Signed-off-by: Matthias Gatto <matthias.gatto@protonmail.com>
This commit is contained in:
committed by
Matthias Gatto
parent
bdfdb5fe10
commit
9803032b9d
@@ -74,6 +74,15 @@ extern "C" {
|
||||
*/
|
||||
#define JSON_C_TO_STRING_NOSLASHESCAPE (1 << 4)
|
||||
|
||||
/**
|
||||
* A flag for the json_object_to_json_string_ext() and
|
||||
* json_object_to_file_ext() functions which causes
|
||||
* the output to be formatted.
|
||||
*
|
||||
* Use color for printing json.
|
||||
*/
|
||||
#define JSON_C_TO_STRING_COLOR (1 << 5)
|
||||
|
||||
/**
|
||||
* A flag for the json_object_object_add_ex function which
|
||||
* causes the value to be added without a check if it already exists.
|
||||
|
||||
Reference in New Issue
Block a user