[sr-dev] git:master:140d0c6f: prevent jansson from shuffling key order in json

kelchy kelchy at bitbucket.org
Mon Jul 6 14:26:26 CEST 2015


Module: kamailio
Branch: master
Commit: 140d0c6fc89d3c72bbd45627ca627e19e45b4e53
URL: https://github.com/kamailio/kamailio/commit/140d0c6fc89d3c72bbd45627ca627e19e45b4e53

Author: kelchy <kelchy at bitbucket.org>
Committer: kelchy <kelchy at bitbucket.org>
Date: 2015-07-06T19:21:41+08:00

prevent jansson from shuffling key order in json

---

Modified: modules/jansson/jansson_utils.c

---

Diff:  https://github.com/kamailio/kamailio/commit/140d0c6fc89d3c72bbd45627ca627e19e45b4e53.diff
Patch: https://github.com/kamailio/kamailio/commit/140d0c6fc89d3c72bbd45627ca627e19e45b4e53.patch

---

diff --git a/modules/jansson/jansson_utils.c b/modules/jansson/jansson_utils.c
index 85f87ad..4919b0e 100644
--- a/modules/jansson/jansson_utils.c
+++ b/modules/jansson/jansson_utils.c
@@ -33,7 +33,7 @@ int jansson_to_val(pv_value_t* val, char** freeme, json_t* v) {
 	val->flags = 0;
 
 	if(json_is_object(v) || json_is_array(v)) {
-		const char* value = json_dumps(v, JSON_COMPACT);
+		const char* value = json_dumps(v, JSON_COMPACT|JSON_PRESERVE_ORDER);
 		*freeme = (char*)value;
 		val->rs.s = (char*)value;
 		val->rs.len = strlen(value);




More information about the sr-dev mailing list