Sitecore and Json serialization - weird conversion

354 Views Asked by At

I have an issues as follows:

On my local, Azure, + 3 other servers my mapping code looks at latitude and longitude coordinates that are stored in a Sitecore item.

On my new QA and PROD Sitecore servers, that I have not used before as they are sitting on a new hosting provider, I have the following issue:

If you look at the picture below: enter image description here

The coordinates are stored correctly but the final output when serialized ot Json is like this: enter image description here

Anyone got any ideas why the decimal point would have been stripped out?

as I said, the code works on many different environments so I am thinking the new hosting provider has set something that is different to my other working environments.

I will keep investigating but thought I would put this out there.

2

There are 2 best solutions below

0
On BEST ANSWER

The answer was this:

Change this:

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

to this:

<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-AU" uiculture="en" />
2
On

Might be a Culture issue. Check that the correct culture is set in web.config or on the page.

Tip: If you want to set the Culture from the Context Sitecore Language, here is how:

Thread.CurrentThread.CurrentCulture = Context.ContentLanguage.CultureInfo;