Hi, Brett!
The only problem I can see with your construction is that you do not
properly initialize the JSON object: $json(foo) = "{}". When the "="
operator is used, the "{}" is interpreted as a simple string, not as a
JSON format. You should have used the ":=" which parses "{}" as a JSON
format and constructs a proper JSON structure, that is populated
afterwards with the desired value.
Anyway, I am not sure why you get that bogus "value". When I replicated
your code, the JSON module returns an error when the $json(foo/bar)
value is retrieved.
Best regards,
Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com
On 01/01/2013 08:21 PM, Brett Nemeroff wrote:
Hey All, I'm using 1.8.2-notls (9330) and I'm having some odd issues
with the JSON module.
If I create an object with json like this:
$avp(baz) = "opensips";
$json(foo) = "{}"
$json(foo/bar) = $avp(baz);
And then I:
xlog("L_INFO","Value of JSON foo/bar is: $json(foo/bar)");
I'll get something like this:
"Value of JSON foo/bar is: opensips>?Q#177"
The ">?Q#177" bit changes from run to run. Looks like memory not
initialized properly?
Now.. if I display the entire contents of foo:
xlog("L_INFO","JSON Object Debug: $json(foo)");
It looks exactly how I'd expect it:
{ "bar": "opensips"}
Additionally, if I push the object into something else, like memcache
and then retrieve it back with the := operator, it then works
perfectly (ie: json object behaves differently if it was created with
a := versus explicitly identifying the paths).
Anyone else run into this?
Additionally, I can't seem to push VALUES that have special characters
in it. I tried to store a typical "datetime" object (2012-12-12
12:12:12 for example) and all I get back is "2012". If I uriencode it,
it works (my workaround for now).
Thoughts?
Thanks!
-Brett
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users