RejectedSoftware Forums

Sign up

How can I receive Json value as string without any casts?

For example, I have an Json string with double field like this:

{"f":123.456}

How can I receive double value 123.456 as string, not as double, to make shure that I haven't got any implicit roundings?

Re: How can I receive Json value as string without any casts?

Am 19.01.2014 20:06, schrieb ilya-stromberg:

For example, I have an Json string with double field like this:

 {"f":123.456}

How can I receive double value 123.456 as string, not as double, to make shure that I haven't got any implicit roundings?

This isn't possible with the current JSON parser, it always converts to
double (matching JavaScript's behavior). Generally, I wouldn't
recommend to send anything that requires more precision because other
JSON implementations probably won't support that either. If you just
want to make sure, you could take vibe.data.json.parseJson and modify
it a bit to retrieve the actual string, it's a very short function.

Generally, supporting this somehow, as well as the inverse, sounds
interesting, though.

Re: How can I receive Json value as string without any casts?

On Tue, 21 Jan 2014 14:02:21 +0100, Sönke Ludwig wrote:

Generally, I wouldn't recommend to send anything that requires more precision because other
JSON implementations probably won't support that either.

Yes, I know. But I have to use third-party software.