summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Calil Khalil2026-02-21 10:39:24 -0300
committerGravatar Nikias Bassen2026-03-20 17:12:47 +0100
commit3edac28498d883f1f768699ee15ce85a82bb2a7b (patch)
treeb350517a84a671fc500d943168f973e7c97aa93e /src/plist.c
parent6e03a1df6d1aa87c8f9e2b35f1a2ca60feca1c0e (diff)
downloadlibplist-3edac28498d883f1f768699ee15ce85a82bb2a7b.tar.gz
libplist-3edac28498d883f1f768699ee15ce85a82bb2a7b.tar.bz2
Add JSON coercion support for non-JSON plist types
- Add PLIST_OPT_COERCE option to coerce PLIST_DATE, PLIST_DATA, and PLIST_UID to JSON-compatible types (ISO 8601 strings, Base64 strings, and integers) - Add plist_to_json_with_options() function to allow passing coercion options (and others) - Update plist_write_to_string() and plist_write_to_stream() to support coercion option - Add --coerce flag to plistutil for JSON output - Create plist2json symlink that automatically enables coercion when invoked
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plist.c b/src/plist.c
index 7697a75..a6d3547 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -2404,7 +2404,7 @@ plist_err_t plist_write_to_string(plist_t plist, char **output, uint32_t* length
2404 err = plist_to_xml(plist, output, length); 2404 err = plist_to_xml(plist, output, length);
2405 break; 2405 break;
2406 case PLIST_FORMAT_JSON: 2406 case PLIST_FORMAT_JSON:
2407 err = plist_to_json(plist, output, length, ((options & PLIST_OPT_COMPACT) == 0)); 2407 err = plist_to_json_with_options(plist, output, length, options);
2408 break; 2408 break;
2409 case PLIST_FORMAT_OSTEP: 2409 case PLIST_FORMAT_OSTEP:
2410 err = plist_to_openstep(plist, output, length, ((options & PLIST_OPT_COMPACT) == 0)); 2410 err = plist_to_openstep(plist, output, length, ((options & PLIST_OPT_COMPACT) == 0));
@@ -2442,7 +2442,7 @@ plist_err_t plist_write_to_stream(plist_t plist, FILE *stream, plist_format_t fo
2442 err = plist_to_xml(plist, &output, &length); 2442 err = plist_to_xml(plist, &output, &length);
2443 break; 2443 break;
2444 case PLIST_FORMAT_JSON: 2444 case PLIST_FORMAT_JSON:
2445 err = plist_to_json(plist, &output, &length, ((options & PLIST_OPT_COMPACT) == 0)); 2445 err = plist_to_json_with_options(plist, &output, &length, options);
2446 break; 2446 break;
2447 case PLIST_FORMAT_OSTEP: 2447 case PLIST_FORMAT_OSTEP:
2448 err = plist_to_openstep(plist, &output, &length, ((options & PLIST_OPT_COMPACT) == 0)); 2448 err = plist_to_openstep(plist, &output, &length, ((options & PLIST_OPT_COMPACT) == 0));