Derrick Bradbury writes:
> I am playing with dsm, trying to extract JSON from a string.
>
> Unless there is an easier way of doing it, I'm using the regex mod to try and
> extract the value out by doing this:
>
> $curl.out =
> '{"state":"INITIAL","enter_uri":"","default_uri":"","hangup_uri":"","connection":[{"uri":"19055551234"}],"server":"","connection_type":"SERIAL","connection_timeout":30,"timeout_uri":"","connect_uri":"","busy_uri":""}'
>
> regex.compile(state,"\"state\"\:[^\,\}]*")
> regex.match(state,$curl.out)
> log(2,$regex.match)
> log(2,$regex.match[1])
clean solution might be to write jsonDecode($jason_var, $dest_struct)
function in mod_utils or a new mod_json.
-- juha
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems