This seems to be intended behaviour for Long values since they can actually 
exceed the max size of a Javascript number. Longs, according to the docs 
<https://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#MAX_VALUE>, 
can go to 263-1, while Javascript can only represent integers safely up to 
about  
<http://stackoverflow.com/questions/307179/what-is-javascripts-highest-integer-value-that-a-number-can-go-to-without-losin>
253 
<http://stackoverflow.com/questions/307179/what-is-javascripts-highest-integer-value-that-a-number-can-go-to-without-losin>.
 
If you don't think you'll need numbers above 253, you could downgrade the 
"number" property to java int and still be safe.



On Thursday, January 14, 2016 at 1:33:13 AM UTC-5, Naresh Pokuri wrote:
>
> I am using google app engine latest version 1.9.30 and I define my cloud 
> endpoint as follows
>
> @Api(name="app", version="v1", 
> transformers={EndpointDateTransformer.class})public class MyEndpoints {
>
>     @ApiMethod(name="dummy", path="dummy", httpMethod=HttpMethod.GET)
>     public Map<String, Object> dummy(){
>         Map<String, Object> dummy = Maps.newHashMap();
>         dummy.put("date", DateUtil.getCurrentTimestamp());
>         dummy.put("number", 5L);
>         return dummy;
>     }
> }
>
> here EndpointDateTransformer converts Date to Long value and the JSON 
> response from endpoint is
>
> {
>     "number": "5",
>     "date": "1452751174672"}
>
> But if I change that 5L to 5 then I see JSON response as
>
> {
>     "number": 5,
>     "date": "1452751174672"}
>
> Why cloud endpoints converting Long values as string in JSON. When I was 
> working on old app engine versions 1.9.19 it used to work. Long rendered as 
> long on JSON as well. Am I missing anything here?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/8bd0ea1f-aa56-4021-86de-1c67e589edbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to