Hi Ruchira,
I meant the automatic JSON conversation not properly handling it. I was
mentioning about another way to convert - but it happens that stringify
method doesn't handle the int array conversion. As we spoke offline - we
will switch to use JSON.stringify afterwards but it would be really helpful
if we can call stringify and it calls JSON.stringify inside the method from
the jaggery side.

Peace~


On Thu, Oct 31, 2013 at 12:32 PM, Ruchira Wageesha <[email protected]> wrote:

>
>
>
> On Thu, Oct 31, 2013 at 11:54 AM, Chan <[email protected]> wrote:
>
>> Hi Ruchira,
>> But the problem is that getContent() method doesn't properly handle int
>> arrays.
>>
> Didn't get it? what do you mean by getContent doesn't handle? Did you mean
> automatic JSON conversion which happens when application/json content type
> is used?
>
> But, it your mail, you had send text/plain?
>
>>
>> Peace~
>>
>>
>> On Wed, Oct 30, 2013 at 3:49 PM, Ruchira Wageesha <[email protected]>wrote:
>>
>>> Hi Chan,
>>>
>>> Instead of parse(), use JSON.parse(). It will solve your problem.
>>> parse() and stringify() methods have been deprecated as ECMAScript 1.5
>>> itself has JSON.parse() and JSON.stringify().
>>>
>>> /Ruchira
>>>
>>>
>>> On Wed, Oct 30, 2013 at 3:25 PM, Chan <[email protected]> wrote:
>>>
>>>> Hi,
>>>> I am trying to send data via post request and int arrays are being lost
>>>> somewhere. My payload is  {"ints": [1,2]}  and what I see in the console
>>>> is {"ints" : [{}, {}]}. I debugged jaggery and figured out that Gson
>>>> properly passes the int array and sends to the buildObject method
>>>> (HostObjectUtils L73). Afterwards the ints are encapsulated in a Rhino
>>>> native array. When we are return the content it is only shown as objects.
>>>>
>>>> I tried sending the request as text/plain and performing
>>>> log.debug(parse(String(request.getContent())));
>>>>
>>>> but still the log is  {"ints" : [{}, {}]}
>>>>
>>>> Peace~
>>>>
>>>> --
>>>> Chan (Dulitha Wijewantha)
>>>> Software Engineer - Mobile Development
>>>> WSO2Mobile
>>>> Lean.Enterprise.Mobileware
>>>>  * ~Email       [email protected]*
>>>> *  ~Mobile     +94712112165*
>>>> *  ~Website   dulithawijewantha.com
>>>> *
>>>> *  ~Blog         
>>>> blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>>> *
>>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>>
>>>
>>>
>>>
>>> --
>>> *Ruchira Wageesha
>>> **Associate Technical Lead*
>>> *WSO2 Inc. - lean . enterprise . middleware |  wso2.com*
>>> *
>>> email: [email protected],   blog: ruchirawageesha.blogspot.com,
>>> mobile: +94 77 5493444*
>>>
>>
>>
>>
>> --
>> Chan (Dulitha Wijewantha)
>> Software Engineer - Mobile Development
>> WSO2Mobile
>> Lean.Enterprise.Mobileware
>>  * ~Email       [email protected]*
>> *  ~Mobile     +94712112165*
>> *  ~Website   dulithawijewantha.com
>> *
>> *  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>> *
>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>
>
>
>
> --
> *Ruchira Wageesha
> **Associate Technical Lead*
> *WSO2 Inc. - lean . enterprise . middleware |  wso2.com*
> *
> email: [email protected],   blog: ruchirawageesha.blogspot.com,   mobile: +94
> 77 5493444*
>



-- 
Chan (Dulitha Wijewantha)
Software Engineer - Mobile Development
WSO2Mobile
Lean.Enterprise.Mobileware
 * ~Email       [email protected]*
*  ~Mobile     +94712112165*
*  ~Website   dulithawijewantha.com
*
*  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
*
*  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to