[OpenSIPS-Users] JSON Bug, empty strings

Muhammad Shahzad shaheryarkh at gmail.com
Sun Feb 10 20:44:29 CET 2013


Nope, i was wrong. It works fine.

        $json(object) := "{'id':'1234567890','name':NULL}";
        $json(object/element) = '';

        xlog("L_WARN", "id: $json(object/id), name: $json(object/name),
element: $json(object/element)");

Results as,

Feb 10 19:39:47 ubuntu-1204 osip-service[13705]: id: 1234567890, name:
<null>, element:

Also, here is null value test,

https://github.com/json-c/json-c/blob/master/tests/test_null.c


Thank you.


On Sun, Feb 10, 2013 at 8:05 PM, Muhammad Shahzad <shaheryarkh at gmail.com>wrote:

> I think libjson_c treats empty string as null. Let me run some tests to
> confirm it.
>
> Thank you.
>
>
> On Sun, Feb 10, 2013 at 6:39 PM, Brett Nemeroff <brett at nemeroff.com>wrote:
>
>> Hey all,
>> I think I see a bug in the JSON module; but it might just be a "feature"
>> of JSON.
>>
>> Seems that when I assign an empty string to a JSON element, it's storing
>> it as NULL. So for example:
>>
>> $json(object/element) = '';
>>
>> If I print that, I get <null> in an xlog.
>>
>> Is this expected? I'd really like to be able to store empty strings.
>>
>> Thanks!
>> -Brett
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
> CISCO Certified Network Associate (CCNA)
> Cell: +49 176 99 83 10 85
> MSN: shari_786pk at hotmail.com
> Email: shaheryarkh at googlemail.com
>



-- 
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +49 176 99 83 10 85
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130210/536821d4/attachment-0001.htm>


More information about the Users mailing list