summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-12-23 03:09:07 +0100
committerGravatar Nikias Bassen2021-12-23 03:09:07 +0100
commit429cbc660ae14d4998715803b44c71abf0e4a339 (patch)
tree12fe08f5dcb00a380536198bac3fffd4eb7dd19b /src/plist.c
parent70002721443dabaa99b56301b537980e137b6249 (diff)
downloadlibplist-429cbc660ae14d4998715803b44c71abf0e4a339.tar.gz
libplist-429cbc660ae14d4998715803b44c71abf0e4a339.tar.bz2
Add support for JSON format
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c
index 61b2913..9f3c8f4 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -49,17 +49,21 @@ extern void plist_xml_init(void);
extern void plist_xml_deinit(void);
extern void plist_bin_init(void);
extern void plist_bin_deinit(void);
+extern void plist_json_init(void);
+extern void plist_json_deinit(void);
static void internal_plist_init(void)
{
plist_bin_init();
plist_xml_init();
+ plist_json_init();
}
static void internal_plist_deinit(void)
{
plist_bin_deinit();
plist_xml_deinit();
+ plist_json_deinit();
}
#ifdef WIN32
@@ -195,6 +199,8 @@ PLIST_API plist_err_t plist_from_memory(const char *plist_data, uint32_t length,
}
if (plist_is_binary(plist_data, length)) {
res = plist_from_bin(plist_data, length, plist);
+ } else if (plist_data[0] == '[' || plist_data[0] == '{') {
+ res = plist_from_json(plist_data, length, plist);
} else {
res = plist_from_xml(plist_data, length, plist);
}