Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2790

Re: json_decode

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Newsgroups comp.lang.php
Subject Re: json_decode
Date Thu, 11 Aug 2011 15:00:33 +0200
Organization http://alvaro.es/
Lines 28
Message-ID <j20jp6$s8v$1@dont-email.me> (permalink)
References <5c4491dc-f228-43e2-a2cd-98cfa6f81d0a@w11g2000vbp.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Thu, 11 Aug 2011 13:00:22 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="cGK1b/hKigUIxJ7GHBGqtg"; logging-data="28959"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XSwmnf80HT/rB2X4AQMpc"
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To <5c4491dc-f228-43e2-a2cd-98cfa6f81d0a@w11g2000vbp.googlegroups.com>
Cancel-Lock sha1:tFjxiDixUz4xBeIhJSYUHhk7xaA=
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:2790

Show key headers only | View raw


El 11/08/2011 11:23, Falk Fiedler escribió/wrote:
> i get from a API a JSON-String with the field:
>
> "id":1070107173001
>
> with json_decode i get:
>
> id = 1.070107173E+12
>
> and i can't work with this value ... is this right, what can i do?
>
> thank you


In my computer, it creates a float but it doesn't lose precision. You 
should be able to work with it without any problem.

If you are getting scientific notation it's because you are casting it 
to string with a function that does not let you choose the format. Just 
handle it as number.



-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

json_decode Falk Fiedler <falk.fiedler@googlemail.com> - 2011-08-11 02:23 -0700
  Re: json_decode Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-11 06:48 -0400
  Re: json_decode "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-11 15:00 +0200

csiph-web