Adding decimal numbers to json objects

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding decimal numbers to json objects

Robert Ernens-3
Hi

I am starting to use the json library and json commands, replacing my own
implementation of json, and I am running into a number conversion issue.

I.E for returning latitude and longitude data in a json object, the decimal
point must be a dot in the json returned.

But on a french 4D system, number are returned with a comma instead of
point.

When adding a number using, $latitude where $latitude contains a decimal
number (i.e. 43,657899) :

$json->add(Œlatitude¹; $latitude)

The json reads Œlatitude¹ : 43,657899   which is an incorrect value

When using
$json->(add(Œlatitude¹; replace string(string($latitude); Œ,¹;¹.¹))

The json reads Œlatitude¹ : ¹43.657899¹ wich is a string value not a number

Anyone has a solution, knowing that the json object cannot be manipulated
prior to its use in javascript.

Thanks for your help.

4D v12 mac and windows, Active4D 6.0 in production and Active4D 6.1 in
development
--
Robert Ernens
HCTBA Consulting
Look2BookOnline - Web-à-la-Carte
4 Rés. Les Bois du Cerf
91450 Etiolles
Tél.: +33.950.58.95.80
GSM : +33.611.78.44.68



_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Adding decimal numbers to json objects

aparajita
Administrator
> I.E for returning latitude and longitude data in a json object, the decimal
> point must be a dot in the json returned.
>
> But on a french 4D system, number are returned with a comma instead of
> point.

That's a bug, can you please report it in the issue tracker?

Many thanks,

  - Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/
Reply | Threaded
Open this post in threaded view
|

Re: Adding decimal numbers to json objects

aparajita
Administrator
>> I.E for returning latitude and longitude data in a json object, the decimal
>> point must be a dot in the json returned.
>>
>> But on a french 4D system, number are returned with a comma instead of
>> point.
>
> That's a bug, can you please report it in the issue tracker?

Never mind, I fixed it.

Regards,

  Aparajita

_______________________________________________
Active4D-dev mailing list
[hidden email]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/