[OpenSIPS-Users] [NEW] JSON module

andrei dragus andreidragus at yahoo.com
Mon Sep 7 14:58:33 CEST 2009



Hello everyone,


A new module has been added to Opensips that provides means for serialization and deserialization of data structures using JSON format.

Benefits of the JSON module:

   - JSON is a widespread format so it can be used to share structured information with other applications
	
   - it can be used to place complex data types into storage as strings (ex: any information can be placed into a database while requiring  only a column of type string )
	
   - it can be used as a general data structure from the script ( array, hashtable ) as it has all the methods specific to these structures ( putting , geting and deleting information) while also allowing the use of script
variables.
	

Requirements:
   - the json module depends on the json-c library that can be found at: http://oss.metaparadigm.com/json-c/ 
	
How to use it:

   - the new module introduces a new variable that provides  methods for all of this.
	
   Example:
	
   $json(obj1) := "{}";       # initialize an empty JSON object
   $json(obj1/key) = "value"; #replace or insert the (key,value)
                              #pair into the json object;
   xlog("$json(obj1)");       # print the serialized version of the object                           
                                   

For more information please read the docs found at: http://www.opensips.org/html/docs/modules/devel/json.html#id228250
 
Hope you find this useful and please report any bugs you may find.
 
 
Andrei.


      



More information about the Users mailing list